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
| -(BOOL)shouldShowAMorPM { | |
| NSDateFormatter *referenceFormatter = [[NSDateFormatter alloc] init]; | |
| [referenceFormatter setDateFormat:@"HH:m zzz"]; | |
| NSDate *refDate = [referenceFormatter dateFromString:[NSString stringWithFormat:@"18:00 %@",[[self timeZone] abbreviation]]]; | |
| NSString *testFormatStr = [self stringFromDate:refDate]; | |
| NSCharacterSet *hourMinDividers = [NSCharacterSet characterSetWithCharactersInString:@"-:."]; | |
| NSString *hour = [[testFormatStr componentsSeparatedByCharactersInSet:hourMinDividers] objectAtIndex:0]; | |
| if ([hour intValue] > 12) { |
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
| <!doctype html> | |
| <html> | |
| <head> | |
| <title></title> | |
| <script src='./jquery.js' type='text/javascript'></script> | |
| <script src='./handlebars.js' type='text/javascript'></script> | |
| <script src='./ember.js' type='text/javascript'></script> | |
| <script type="text/javascript"> | |
| App = Ember.Application.create(); |
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
| #!/usr/local/bin/ruby | |
| require 'mail' | |
| require 'tempfile' | |
| require 'beanstalk-client' | |
| require "#{File.dirname(__FILE__)}/mail_env" | |
| File.umask(0111) | |
| # Parse the incoming message | |
| emailfile=Tempfile.new("email") |
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
| // In this sorting function, we have three indices in our array | |
| // a[0] - the name of the injection | |
| // a[1] - the name of an injection that THIS injection should be before | |
| // a[2] - the name of an injection that THIS injection should be after | |
| // When given an array: | |
| // [['b', 'c', null], ['a','b', null], ['d', null, 'c'], ['c', null, null], ['e', null, 'd']]; | |
| // Then the output from this array should look like: | |
| // [['a','b', null], ['b', 'c', null], ['c', null, null], ['d', null, 'c'], ['e', null, 'd']]; |
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
| #!/usr/bin/perl | |
| while (<>) { | |
| /(.+)\s(.+)\s(.+)\s(.+)\s(.+)$/; | |
| $addr = $5; | |
| $name = $1; | |
| $1 =~ /(.+)\.(.+)\.(.+)\.(.+)\.in-addr.+/; | |
| print $addr," 10800 IN A ", $4, ".", $3, ".", $2, ".", $1, "\n"; | |
| } |
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
| App.Adapter = DS.RESTAdapter.extend | |
| # Add CSRF Token from Rails to non-get requests | |
| ajax: (url, type, hash) -> | |
| if hash.data and type isnt "GET" | |
| hash.data['authenticity_token'] = jQuery("meta[name='csrf-token']").attr("content") | |
| @_super(url,type,hash) |
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
| addImages: (files) -> | |
| formData = new FormData() | |
| # Attach block id | |
| formData.append "attachments[book_id]", @get('content.id') | |
| # Loop through the FileList and render image files as thumbnails. | |
| for file in files | |
| # Only process image files. | |
| if file.type.match("image.*") |
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
| class WebSocket | |
| constructor: (url) -> | |
| cordova.exec (-> return true), (-> return false), "WebSocketPlugin", "createSocket", [url] | |
| cordova.exec @_onerror, (->), "WebSocketPlugin", "registerCallback", ["onerror"] | |
| cordova.exec @_onopen, (->), "WebSocketPlugin", "registerCallback", ["onopen"] | |
| cordova.exec @_onclose, (->), "WebSocketPlugin", "registerCallback", ["onclose"] | |
| cordova.exec @_onmessage, (->), "WebSocketPlugin", "registerCallback", ["onmessage"] | |
| send: (message) -> | |
| cordova.exec (-> return true), (-> return false), "WebSocketPlugin", "send", [message] |
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
| class File | |
| def to_str | |
| path | |
| end | |
| end | |
| class Hamlbars::Converter | |
| def self.process_directory(directory) | |
| dir = Dir.open(directory) |
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
| Ember.ArrayPipelinePlugin = Ember.Object.extend | |
| # | |
| # Public | |
| # | |
| # Define a set of properties you would like to observe on the array for | |
| # reprocessing. | |
| # | |
| # If another plugin earlier in the pipeline observes the same property, | |
| # then this plugin will wait to process until the other plugin in the pipeline |