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
# OS X temporary files that should never be committed | |
.DS_Store | |
*.swp | |
*.lock | |
profile | |
# Xcode temporary files that should never be committed | |
*~.nib | |
# Xcode build files - |
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
NSMutableString *js = [NSMutableString stringWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"individualnotification" ofType:@"js"] encoding:NSUTF8StringEncoding error:nil]; | |
[js appendString:@"getHeightForElementById(\"idNotificationContent\")"]; | |
float height = [[contentWebView stringByEvaluatingJavaScriptFromString:js] floatValue]; | |
function getHeightForElementById(elementID) { | |
var height = 0; | |
var subElements = Array(); | |
var element = document.getElementById(elementID); |
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
CATransform3D transform = CATransform3DIdentity; | |
transform.m34 = 1.0/700.0; | |
transform = CATransform3DRotate(transform, M_PI, 0, 1, 0); | |
CATransform3D transform2 = CATransform3DRotate(transform, -M_PI/2, 0, 1, 0); | |
CATransform3D transform3 = CATransform3DRotate(transform2, -M_PI/2, 0, 1, 0); | |
CALayer *layer = self.cardView.layer; | |
CABasicAnimation *rotation = [CABasicAnimation animationWithKeyPath:@"transform"]; | |
rotation.fromValue = [NSValue valueWithCATransform3D:transform]; | |
rotation.toValue = [NSValue valueWithCATransform3D:transform2]; |
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
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
) | |
func main() { | |
str := `{"hello":{"nested":{"world":"!"}}}` | |
fmt.Println("input string : ", str) |
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
extension UIImage { | |
func resizeCG(size:CGSize) -> UIImage? { | |
let bitsPerComponent = CGImageGetBitsPerComponent(self.CGImage) | |
let bytesPerRow = CGImageGetBytesPerRow(self.CGImage) | |
let colorSpace = CGImageGetColorSpace(self.CGImage) | |
let bitmapInfo = CGImageGetBitmapInfo(self.CGImage) | |
let context = CGBitmapContextCreate(nil, Int(size.width), Int(size.height), bitsPerComponent, bytesPerRow, colorSpace, bitmapInfo.rawValue) | |
CGContextSetInterpolationQuality(context, .High) | |
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
//https://api.flickr.com/services/rest/?method=flickr.interestingness.getList&api_key=aa621a9050ef8dfbd9621cc311da86aa&format=json | |
-(NSString*) flickrInterestingGenerateUrlFromInfo:(NSDictionary*) info { | |
return [NSString stringWithFormat:@"http://farm%@.static.flickr.com/%@/%@_%@_t.jpg", | |
[info objectForKey:@"farm"], | |
[info objectForKey:@"server"], | |
[info objectForKey:@"id"], | |
[info objectForKey:@"secret"]]; | |
} |
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
sudo apt-get install libgnome-keyring-dev | |
sudo make --directory=/usr/share/doc/git/contrib/credential/gnome-keyring | |
git config --global credential.helper /usr/share/doc/git/contrib/credential/gnome-keyring/git-credential-gnome-keyring |
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
final class DataCoordinator { | |
//MARK: - singleton | |
private static var coordinator: DataCoordinator? | |
public class func sharedInstance() -> DataCoordinator { | |
if coordinator == nil { | |
coordinator = DataCoordinator() | |
} | |
return coordinator! | |
} | |
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
file_name = 'SMSSpamCollection' | |
with open(file_name) as f: | |
corpus = f.readlines() | |
print("there are {} messages".format(len(corpus))) | |
corpus = [x.strip() for x in corpus] #remove trailing \n from lines | |
for i,message in enumerate(corpus[:10]): | |
print(i, message) |
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
with open('SMSSpamCollection',encoding='UTF-8') as f: | |
messages = pd.read_csv(f, sep='\t', quoting=csv.QUOTE_NONE, names=['label', 'message']) | |
messages['message'] = messages['message'].map(lambda text:text.decode(encoding='utf-8')) | |
messages.head() |
OlderNewer