This file contains 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
priceRanges = { | |
"highSpike": [ | |
{ | |
"2": { | |
"low": 77, | |
"high": 99 | |
}, | |
"3": { | |
"low": 81, | |
"high": 154 |
This file contains 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 <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <algorithm> | |
// munged from https://github.com/simontime/Resead | |
namespace sead | |
{ |
This file contains 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
if (document.querySelector("#my-tmp-audio") === null) { | |
let aDiv = document.createElement("div"); // can edit gist? | |
aDiv.innerHTML = "<audio controls autoplay id='my-tmp-audio' style='display: none'></audio>"; | |
document.body.appendChild(aDiv); | |
} |
This file contains 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
<table> | |
<tbody> | |
{ | |
data.map((record, i) => <tr key={i}> | |
<td>{record.id}</td> | |
<td>{record.name}</td> | |
</tr>) | |
} | |
</tbody> | |
</table> |
This file contains 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
# add to your ~/.bashrc | |
function stopwatch() { | |
local BEGIN=$(date +%s) | |
while true; do | |
local NOW=$(date +%s) | |
local DIFF=$(($NOW - $BEGIN)) | |
local MINS=$(($DIFF / 60 % 60)) | |
local SECS=$(($DIFF % 60)) |
This file contains 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
2012-09-15 14:20:27.621 DrawingFun[16907:303] Hierarchy: | |
2012-09-15 14:20:27.621 DrawingFun[16907:303] <NSView: 0x100604ba0> frame: {{0, 0}, {480, 360}} | |
2012-09-15 14:20:27.621 DrawingFun[16907:303] <NSScrollView: 0x100605140> frame: {{30, 14}, {400, 300}} | |
2012-09-15 14:20:27.621 DrawingFun[16907:303] <NSClipView: 0x100608220> frame: {{1, 1}, {398, 298}} | |
2012-09-15 14:20:27.621 DrawingFun[16907:303] <StretchView: 0x1001399a0> frame: {{0, -3}, {800, 600}} | |
2012-09-15 14:20:27.622 DrawingFun[16907:303] <NSScroller: 0x10011a070> frame: {{383, 1}, {16, 298}} | |
2012-09-15 14:20:27.622 DrawingFun[16907:303] <NSScroller: 0x10011aa40> frame: {{1, 283}, {398, 16}} | |
This file contains 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) printSubviews:(NSView *) view withLevel:(int) level { | |
NSLog(@"%*s%@ frame: %@", level * 4, "", view, NSStringFromRect(view.frame)); | |
for (NSView *sv in [view subviews]) { | |
[self printSubviews:sv withLevel:level+1]; | |
} | |
} | |
-(void) printSubviews:(NSView *) view { | |
NSLog(@"Hierarchy:"); |
This file contains 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
NSArray *array = @[ | |
@"hello", | |
@"world", | |
[NSNull null], | |
@123, | |
@123.456 | |
]; | |
[array enumerateObjectsUsingBlock:^(id obj, NSUInteger i, BOOL *stop) { | |
NSLog(@"obj %d is %@", i, obj); |
This file contains 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
NSDictionary *dictionary = @{ | |
@"hello" : @"world", | |
@12 : @"foo", | |
@123.456 : @56, | |
@"how are you" : @1 | |
}; | |
for (id key in dictionary) { | |
NSLog(@"key is %@ and value is %@", key, [dictionary objectForKey:key]); | |
} |
This file contains 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
NSArray *array2 = @[ | |
@"hello", | |
@"world", | |
[NSNull null], | |
@123, | |
@123.456 | |
]; | |
for (id obj in array2) { | |
NSLog(@"the obj is %@", obj); |
NewerOlder