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)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
UITextView *hi = [[UITextView alloc] init]; | |
hi.translatesAutoresizingMaskIntoConstraints = NO; | |
hi.text = @"hi there"; | |
hi.textColor = [UIColor blackColor]; | |
[hi sizeToFit]; | |
[self.view addSubview:hi]; |
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
### Keybase proof | |
I hereby claim: | |
* I am samsonjs on github. | |
* I am samsonjs (https://keybase.io/samsonjs) on keybase. | |
* I have a public key whose fingerprint is BBED 74DD 17DB 7C8F 7664 4FE2 0522 38DD 367F 2A76 | |
To claim this, I am signing this object: |
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
<h1>header 1</h1> | |
<h2>header 2</h2> | |
<h3>header 3</h3> | |
<h4>header 4</h4> | |
<h5>header 5</h5> | |
<h6>header 6</h6> | |
<p>paragraph</p> | |
<b>bold</b> |
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
// Courtesy of http://www.chupamobile.com | |
function center_this_bitch(target, context, animate) { | |
var top, left, context_target; | |
animate = typeof animate !== 'undefined' ? animate : false; | |
switch (context) { | |
case'parent': | |
context_target = target.parent(); | |
top = ((context_target.height() - target.height()) / 2) + 'px'; | |
left = ((context_target.width() - target.width()) / 2) + 'px'; |
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
[ 9:46am] ~/Projects % cat >hello.swift | |
#!/usr/bin/env xcrun swift -i | |
println("Hello, world!") | |
[ 9:47am] ~/Projects % chmod +x hello.swift | |
[ 9:47am] ~/Projects % ./hello.swift | |
Hello, world! |
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
#import <Foundation/Foundation.h> | |
NSDictionary *TestD(void) { | |
return @{ | |
@"string" : @"abc", | |
@"number" : @42, | |
@"dictionary" : @{ | |
@"string" : @"abcdef", | |
@"array" : @[ @"a", @2 ] | |
}, |
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
(let ((a 1) | |
(b 2)) | |
(foo a b)) |
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
! function() { | |
function hasClass(el, klass) { | |
return el.className.match(new RegExp("(\\s|^)" + klass + "(\\s|$)")) | |
} | |
function addClass(el, klass) { | |
hasClass(el, klass) || (el.className += " " + klass) | |
} | |
function removeClass(el, klass) { |
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
@interface AsyncAPI : NSObject | |
- (void)doSomethingForOwner:(__weak id)owner completionBlock:(void (^)(id welf, id result))complete; | |
@end | |
@implementation AsyncAPI | |
- (void)doSomethingForOwner:(__weak id)owner completionBlock:(void (^)(id welf, id result))complete { | |
[self doTheAsyncThing:^(id result) { | |
if (owner && complete) { | |
complete(owner, result); | |
} |
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
#!/usr/bin/env ruby -w | |
require 'faraday' | |
require 'json' | |
require 'nokogiri' | |
def sunsets_from_html(html) | |
doc = Nokogiri::HTML(html) | |
table = doc.css('table').first | |
table.css('br').each { |newline| newline.replace("\n") } |
OlderNewer