片段Tag
abap abc ActionScript ActionScript 3 Apache apache_conf AppleScript asciidoc ASP Assembler assembly_x86 autohotkey AutoIt Awk Bash batchfile C C# C++ c9search cirru Clojure coffee ColdFusion csharp CSS curly c_cpp d dart Delphi diff Django dockerfile DOS Batch dot drools eiffel ejs elixir elm Emacs Lisp erlang eZ Publish forth fortran ftl gcode gherkin gitignore glsl golang graphqlschema Groovy HAML handlebars Haskell haxe hjson HTML html4strict html_elixir html_ruby ini io iPhone jack jade Java javascript jQuery json jsoniq jsp jsx julia kotlin LaTeX less liquid lisp livescript lsl Lua luapage Makefile markdown MatLab mel MXML MySQL nix nsis Objective C objectivec ocaml Other Pascal perl pgsql php pig PL/SQL plain_text powershell Processing Prolog properties protobuf Pseudocode Python R Rails razor Regular Expression rst Ruby rust SAS SASS scad Scala Scheme scss sh sjs Smarty snippets space SQL sqlserver stylus svg SVN swift swig Symfony TCL tex text textile Textpattern toml tsx twig typescript TYPO3 vala vb VB.NET vbscript velocity verilog VHDL Visual Basic vproperties Windows PowerShell Windows Registry XHTML XML xquery XSLT yaml

PHP - testdummy

public function testdummy ( $value=\'\' ) {
/*** Description ***/
	# code...
}

Other - growlnotify用法

growlnotify usage:

growlnotify -s -t \'Title\' -m \'Message\'

-s Sticky 
-m Message
-t Tilte
-p Priority
-H, -host Network

Other - 缓冲协议

@protocol BufferSaveFilterProtocol : NSObject
- (NSFileHandle*)buffer:(Buffer*)aBuffer willSaveFile:(NSFileHandle*)aFileHandle;
@end

HTML - OSCommerce表宽度

Change

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
<tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->

To

<!-- body //-->
<table border="0" width="770" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->

All of the files in the catalog folder plus the catalog/includes/header.php and catalog/includes/footer.php files will need to be changed. A quick find and replace in your editor will replace all the pages that have the same code as above in the catalog folder. The header.php and footer.php files have a little different code and would need to be manually changed.

C++ - 加入c desde c

extern \"C\" {
    #include \"header.h\"
}

JavaScript - 修复IE Hi-Res Bug

function fnScaleFactorX() {
   nScaleFactor = screen.deviceXDPI / screen.logicalXDPI;
   return nScaleFactor;
}
if (fnScaleFactorX() > 1) {
   document.getElementById("block_1").style.marginBottom = "-26000px";
}

Other - tar命令

tar -czvf file.tar.gz dir/*

PHP - PHP:打印html标题

function print_header( $title ) {
		echo 	\"<!DOCTYPE HTML PUBLIC \\\"-//W3C//DTD HTML 4.01//EN\\\" \\\"http://www.w3.org/TR/html4/strict.dtd\\\"><html lang=\\\"de\\\"><head><meta http-equiv=\\\"content-type\\\" content=\\\"text/html; charset=utf-8\\\" /><title>\" . $title . \"</title><link rel=\\\"shortcut icon\\\" href=\\\"favicon.ico\\\" type=\\\"image/x-icon\\\"><link rel=\\\"stylesheet\\\" type=\\\"text/css\\\" href=\\\"corax.css\\\"></head><body>\";
	};

Objective C - AñadeuncÃrculorojo con un texto en blanco al icono delaaplicaciónenel dock

-(void) updateApplicationIcon:(int) theNumber:(NSRect) theRect{
	// get the current app icon
	NSImage *appImage = [NSImage imageNamed:@"NSApplicationIcon"];
	
	// create a new image and draw the app icon onto it
	NSImage *image = [[NSImage alloc] initWithSize:[appImage size]];
	
	// lock focus on the new image and draw the app icon onto it.
	// you'll want the image flipped so text shows up correctly
	[image setFlipped:TRUE];
	[image lockFocus];
	NSSize appSize = [appImage size];	
	[appImage compositeToPoint:NSMakePoint(0, appSize.height) 
					 operation:NSCompositeSourceOver];
	
	// draw red circle
	NSBezierPath *redCircle = [NSBezierPath bezierPathWithOvalInRect:NSMakeRect(8,43,45,45)];
	[[NSColor redColor] setFill];
	[redCircle fill];
	
	// draw whatever else you want onto the image
	NSArray *values = [NSArray arrayWithObjects:[NSColor whiteColor], [NSFont fontWithName:@"Tahoma" size:32], nil];
	NSArray *keys = [NSArray arrayWithObjects:NSForegroundColorAttributeName, NSFontAttributeName, nil];
	
	NSDictionary *attrs = [NSDictionary dictionaryWithObjects:values forKeys:keys];
	NSString *caption= [NSString stringWithFormat:@"%d", theNumber];
	NSAttributedString *text= [[NSAttributedString alloc] initWithString:caption attributes:attrs];
	[text drawInRect:theRect];
	
	// unlock focus and set the new image as the dock icon
	[image unlockFocus];
	[NSApp setApplicationIconImage:image];
}

Objective C - Limpiar el icono delaaplicaciónenel dock

-(void) initApplicationIcon{
	// empty application icon
	NSImage *appImage = [NSImage imageNamed:@"NSApplicationIcon"];
	[NSApp setApplicationIconImage:appImage];
}