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
| CATEGORIES = [ | |
| "Sports", | |
| "Entertainment", | |
| "Comedy", | |
| "News & Politics", | |
| "Business", | |
| "Society & Culture", | |
| "Technology", | |
| "Health & Fitness", | |
| "en Español", |
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
| function secondsToHoursMinutesSeconds(totalSec) { | |
| totalSec = Math.round(totalSec) | |
| var hours = Math.floor(totalSec / 3600) % 24 | |
| totalSec -= hours * 3600 | |
| var minutes = Math.floor(totalSec / 60) % 60 | |
| totalSec -= minutes * 60 | |
| return padToTwo(hours) + ':' + padToTwo(minutes) + ':' + padToTwo(totalSec) | |
| } | |
| // 3000 -> "50:00" |
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 Promise = require('bluebird') | |
| var a = Promise.reject(new Error('load failed')).delay(100) | |
| var b = Promise.resolve(123).delay(50) | |
| var queue = [a,b] | |
| function processQueue() { | |
| var next = queue.shift() | |
| if (next) { | |
| return next.catch(processQueue) | |
| } 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
| # Stuff with obvious replacements: | |
| image_science, rmagick => mini_magick (not a drop-in replacement) | |
| mysql2 => activerecord-jdbc-adapter, jdbc-mysql | |
| unicorn => puma | |
| # Stuff that we only use because they're optimized: | |
| hiredis | |
| yajl-ruby => json |
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
| int main(int argc, char * argv[]) | |
| { | |
| DrawInfo* info = AcquireMagickMemory(sizeof(*info)); | |
| GetDrawInfo(NULL, info); | |
| DestroyDrawInfo(info); | |
| return 0; | |
| } |
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
| $ gcc -I/ec/include/ImageMagick-6/ -L/ec/lib -lMagickCore-6.Q16 ./magick.c | |
| $ UMEM_DEBUG=default,audit,verbose ./a.out | |
| umem allocator: redzone violation: write past end of buffer | |
| buffer=8103bc0 bufctl=8106a58 cache: umem_alloc_640 | |
| previous transaction on buffer 8103bc0: | |
| thread=1 time=T-0.000636133 slab=8105f98 cache: umem_alloc_640 | |
| libumem.so.1'umem_cache_alloc_debug+0x1fe | |
| libumem.so.1'umem_cache_alloc+0x18f | |
| libumem.so.1'umem_alloc+0x50 | |
| libumem.so.1'malloc+0x36 |
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
| DrawInfo* info = malloc(sizeof(*info)); | |
| GetDrawInfo(NULL, info); | |
| DestroyDrawInfo(info); |
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
| @interface Person : NSObject | |
| @property NSString* firstName, *lastName; | |
| -(NSString*)fullName; | |
| @end | |
| @implementation Person | |
| + (NSSet *)keyPathsForValuesAffectingFullName { | |
| return [NSSet setWithObjects:@"lastName", @"firstName", nil]; | |
| } |
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
| __block NSManagedObjectID objectID = nil; | |
| [moc performBlockAndWait: ^{ | |
| NSManagedObject* object = findOrCreateSomethingSpecial(moc); | |
| objectID = object.objectID; | |
| }]; | |
| dispatch_async(dispatch_get_main_queue(), ^{ | |
| doSomethingWith(objectID); | |
| }); |
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
| Master: | |
| [69165] 05 Mar 15:19:02.664 * DB saved on disk | |
| [38026] 05 Mar 15:19:06.211 * Background saving terminated with success | |
| [38026] 05 Mar 15:19:06.483 * Slave ask for synchronization | |
| [38026] 05 Mar 15:19:06.483 * Starting BGSAVE for SYNC | |
| [38026] 05 Mar 15:19:07.178 * Background saving started by pid 71219 | |
| [71219] 05 Mar 15:19:47.809 * DB saved on disk | |
| [38026] 05 Mar 15:19:51.126 * Background saving terminated with success | |
| [38026] 05 Mar 15:19:51.497 * Slave ask for synchronization | |
| [38026] 05 Mar 15:19:51.497 * Starting BGSAVE for SYNC |