Instantly share code, notes, and snippets.
veader /gist:c2dfa95982c9a91b5253
CreatedJanuary 5, 2016 19:13
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
--- Part Two --- | |
Now that the machine is calibrated, you're ready to begin molecule fabrication. | |
Molecule fabrication always begins with just a single electron, e, and applying | |
replacements one at a time, just like the ones during calibration. | |
For example, suppose you have the following replacements: | |
e => H |
veader /gist:83ab70ff65c1dbac62a7
CreatedNovember 18, 2015 19:09
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
# ruby 2.1.6 | |
irb(main):006:0> 0.30 * 100 | |
=> 30.0 | |
irb(main):007:0> 0.29 * 100 | |
=> 28.999999999999996 | |
irb(main):008:0> 0.28 * 100 | |
=> 28.000000000000004 | |
irb(main):009:0> 0.27 * 100 | |
=> 27.0 |
veader /gist:7e17260c66a2a467f0db
CreatedOctober 5, 2015 20:27
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
peripheral:didDiscoverServices: | |
<CBService: 0x134db3950, isPrimary = YES, UUID = Device Information> | |
peripheral:didDiscoverDescriptorsForCharacteristic: | |
<CBCharacteristic: 0x134f1a020, UUID = Manufacturer Name String, properties = 0x2, value = (null), notifying = NO> |
veader /gist:f078e94b58c70bf509f1
CreatedMay 21, 2015 12:52
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
defto_live? | |
if !@to_live | |
@to_live=true | |
returntrue | |
end | |
!@to_live | |
end |
veader /keybase.md
CreatedMarch 16, 2014 19:39
veader /gist:9102508
Last activeAugust 29, 2015 13:56
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)testShouldDecodeBase64EncodedString { | |
NSString *encodedString =@"ZEdWemRBPT0="; | |
NSString *decodedString = [[NSStringstringWithBase64EncodedString:encodedString]base64DecodedString]; | |
NSString *properResult =@"test"; | |
XCTAssert([properResultisEqualToString:decodedString],@"Unable to decode base64 encoded string"); | |
} | |
- (void)testShouldWorkWithoutCategoryToDecodeUTF8String { | |
NSString *encodedString =@"dTA0QTA6INKgINKhINKiINKjINKkINKlINKmINKnINKoINKpINKqINKrINKsINKtINKuINKvINKwINKxINKyINKzINK0INK1INK2INK3INK4INK5INK6INK7INK8INK9INK+INK/"; | |
NSData *encodedData = [[NSDataalloc]initWithBase64Encoding:encodedString]; |
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
// these are the routes I'd like to define | |
// | |
// /posts (load all posts) | |
// /posts/all (only here for completeness) | |
// /posts/archived (load only archived posts) | |
// /posts/unpublished (load only unpublished posts) | |
// /posts/1 (load individual post) | |
// the only way I can see doing it in Ember at this point (1.0) | |
App.Router.map({ |
veader /gist:5319241
CreatedApril 5, 2013 13:24
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
vagrant@precise64:~$ ifconfig | |
eth0 Link encap:Ethernet HWaddr 08:00:27:88:0c:a6 | |
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0 | |
inet6 addr: fe80::a00:27ff:fe88:ca6/64 Scope:Link | |
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 | |
RX packets:9696 errors:0 dropped:0 overruns:0 frame:0 | |
TX packets:9562 errors:0 dropped:0 overruns:0 carrier:0 | |
collisions:0 txqueuelen:1000 | |
RX bytes:943407 (943.4 KB) TX bytes:808267 (808.2 KB) |
veader /gist:3693592
CreatedSeptember 10, 2012 20:24
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
# monkey patch resolver to properly decode URI encoded attributes | |
classActiveRecord::Base::ConnectionSpecification | |
classResolver | |
private | |
defconnection_url_to_hash(url) | |
config=URI.parseurl | |
adapter=config.scheme | |
adapter="postgresql"ifadapter =="postgres" | |
spec={:adapter=>adapter, | |
:username=>config.user, |
veader /gist:2241772
CreatedMarch 29, 2012 18:39
NewerOlder