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
| <?php | |
| $return = ''; | |
| $date = strtotime($date); | |
| $diff = time() - $date; | |
| if ($diff < 86400) { | |
| if ($diff < 3600) { // Output e.g. 35 minutes ago | |
| $return = $mins = floor($diff / 60); | |
| $return .= ' minute'; | |
| if ($mins > 1 || $mins === 0) $return .= 's'; |
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
| -(void)startAnimationUIBarButtonItem:(UIBarButtonItem *)buttonItem | |
| { | |
| [UIView animateWithDuration:2.0 delay:0.0 options:UIViewAnimationOptionRepeat | UIViewAnimationOptionCurveLinear animations:^{ | |
| CGAffineTransform transform = CGAffineTransformMakeRotation(M_PI); | |
| UIView *view = [buttonItem valueForKey:@"view"]; | |
| view.transform = transform; | |
| } completion:NULL]; | |
| } | |
| -(void)stopAnimationUIBarButtonItem:(UIBarButtonItem *)buttonItem |
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
| var $body = angular.element(document.body); | |
| var $rootScope = $body.injector().get('$rootScope'); | |
| setInterval(function(){ | |
| $rootScope.devices[0].appetizer.emit("userInteraction", {type: "heartbeat"}); | |
| }, 1000); |
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
| extension String { | |
| func size(withAttributes attrs: [String:AnyObject], constrainedTo box: NSSize) -> NSRect { | |
| let storage = NSTextStorage(string: self) | |
| let container = NSTextContainer(containerSize: NSSize(width: box.width, height: box.height)) | |
| let layout = NSLayoutManager() | |
| layout.addTextContainer(container) | |
| storage.addLayoutManager(layout) | |
| storage.addAttributes(attrs, range: NSMakeRange(0, storage.length)) | |
| container.lineFragmentPadding = 0.0 | |
| let _ = layout.glyphRangeForTextContainer(container) |
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
| @import url(http://fonts.googleapis.com/css?family=Raleway:700,800); | |
| html, body { margin: 0; } | |
| :focus { outline: none; } | |
| ::-webkit-input-placeholder { color: #DEDFDF; } | |
| ::-moz-placeholder { color: #DEDFDF; } | |
| :-moz-placeholder { color: #DEDFDF; } | |
| ::-ms-input-placeholder { color: #DEDFDF; } |
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
| import android.text.TextUtils; | |
| import java.io.UnsupportedEncodingException; | |
| import java.security.MessageDigest; | |
| import java.security.NoSuchAlgorithmException; | |
| import java.util.ArrayList; | |
| import java.util.List; | |
| /** | |
| * @author Miguel Catalan Bañuls |
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 Roboto Condensed font in your project | |
| * | |
| * Download Roboto Condensed ttf files from Google Fonts and place it in the same directory of this CSS file | |
| * You can then use this font in your project by setting | |
| * font-face: "Roboto Condensed", Helvetica, Arial, sans-serif; | |
| * | |
| * @author Mattia Migliorini (deshack) | |
| * @license MIT | |
| */ |
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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
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
| /* | |
| * At its core, Backstretch is a one-line plugin. | |
| * Just pass in the path to an image, and you're done. | |
| */ | |
| $.backstretch("http://dl.dropbox.com/u/515046/www/garfield-interior.jpg"); |
NewerOlder