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
// 1: how could you rewrite the following to make it shorter? | |
if (foo) { | |
bar.doSomething(el); | |
} else { | |
bar.doSomethingElse(el); | |
} | |
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 python | |
''' | |
Takes a GitHub service hook POST and automatically updates the associated repo. | |
''' | |
__license__ = ''' | |
Copyright 2009 Jake Wharton | |
hookpuller is free software: you can redistribute it and/or modify |
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
// geo-location shim | |
// currentely only serves lat/long | |
// depends on jQuery | |
;(function(geolocation){ | |
if (geolocation) return; | |
var cache; |
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
#!/bin/bash | |
# | |
# tomcat7 This shell script takes care of starting and stopping Tomcat | |
# | |
# chkconfig: - 80 20 | |
# | |
### BEGIN INIT INFO | |
# Provides: tomcat7 | |
# Required-Start: $network $syslog | |
# Required-Stop: $network $syslog |
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
In [1]: import boto | |
In [2]: c = boto.connect_s3() | |
In [3]: b = c.lookup('test-1245812163') | |
In [4]: mp = b.initiate_multipart_upload('testmpupload2') | |
In [5]: mp | |
Out[5]: <MultiPartUpload testmpupload2> |
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 ruby1.9.1 | |
# | |
# Testing multipart uploads into s3 | |
# Very basic script for testing how the functionality works | |
# | |
# Takes a file, splits it up | |
# For each part get the base64 encoded md5 of the part | |
# Then run through the parts and upload them | |
# Refs: |
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
#!/bin/bash | |
# nodejs - Startup script for node.js server | |
# chkconfig: 35 85 15 | |
# description: node is an event-based web server. | |
# processname: node | |
# server: /path/to/your/node/file.js | |
# pidfile: /var/run/nodejs.pid | |
# |
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
.border-radius (@radius) { | |
-webkit-border-radius: @radius; | |
-o-border-radius: @radius; | |
-moz-border-radius: @radius; | |
-ms-border-radius: @radius; | |
border-radius: @radius; | |
} | |
.user-list { | |
// need to use special `.` syntax |
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 | |
// 1. Wildcard Pattern | |
func wildcard(a: String?) -> Bool { | |
guard case _? = a else { return false } | |
for case _? in [a] { | |
return true | |
} | |
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 turtle | |
def turn(i): | |
left = (((i & -i) << 1) & i) != 0 | |
return 'L' if left else 'R' | |
def curve(iteration): | |
return ''.join([turn(i + 1) for i in range(2 ** iteration - 1)]) | |
if __name__ == '__main__': |
OlderNewer