This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Override UICollectionViewFlowLayout class | |
| @interface FixedHeaderLayout : UICollectionViewFlowLayout | |
| @end | |
| @implementation FixedHeaderLayout | |
| //Override shouldInvalidateLayoutForBoundsChange to require a layout update when we scroll | |
| - (BOOL) shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds { | |
| return YES; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| until [ -z $1 ]; do | |
| unix2dos $1 2>/dev/null | |
| iconv -f UTF-8 -t GBK $1 -o /tmp/unix2doc.tmp 2>/dev/null | |
| if [ $? -eq 0 ]; then | |
| mv /tmp/unix2doc.tmp $1 | |
| echo "linux2win: converting file $1 to WIN format ..." | |
| else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* a clever way to implement string multiplication in JavaScript */ | |
| String.prototype.times = function(n) { | |
| return Array.prototype.join.call({length:n+1}, this); | |
| }; | |
| "js".times(5) // => "jsjsjsjsjs" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #include <setjmp.h> | |
| jmp_buf __exception_context; | |
| #define try if(!setjmp(__exception_context)) | |
| #define catch else | |
| #define throw_exception longjmp(__exception_context, 1) | |