This file contains hidden or 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
var fs = require('fs'); | |
app.use(function(req, res, next) { | |
req.rawBody = ''; | |
req.setEncoding('utf8'); | |
req.on('data', function(chunk) { | |
req.rawBody += chunk; | |
}); |
This file contains hidden or 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
{ | |
"Version": "2008-10-17", | |
"Id": "b2cc31d0-cc91-4285-a658-473099d2c867", | |
"Statement": [ | |
{ | |
"Sid": "AllowPublicRead", | |
"Effect": "Allow", | |
"Principal": { | |
"AWS": "*" | |
}, |
This file contains hidden or 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 | |
TITLE=`osascript -e 'tell application "Google Chrome" \ | |
to return title of active tab of front window'` | |
URL=`osascript -e 'tell application "Google Chrome" \ | |
to return URL of active tab of front window'` | |
TEXT=`osascript -e 'tell application "Google Chrome" \ | |
to execute the active tab of front window \ |
This file contains hidden or 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
def call_command(command): | |
process = subprocess.Popen(command.split(' '), | |
stdout=subprocess.PIPE, | |
stderr=subprocess.PIPE) | |
return process.communicate() | |
# Ex usage: call_command("sudo mount {dev} {mnt}".format(dev=device_path, mnt=mount_path)) |
This file contains hidden or 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 | |
s3cmd sync --delete-removed ./mybucket-local/ s3://mybucket.com | |
s3cmd setacl --acl-public --recursive s3://mybucket.com |
This file contains hidden or 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
server { | |
listen 80; | |
server_name myblog.com; | |
root /var/www/wp-blog; | |
## This should be in your http block and if it is, it's not needed here. | |
index index.html index.php; | |
location = /favicon.ico { |
This file contains hidden or 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
#CORS middleware | |
allowCrossDomain = (req, res, next) -> | |
res.header 'Access-Control-Allow-Origin', '*' | |
res.header 'Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE' | |
res.header 'Access-Control-Allow-Headers', 'Content-Type, X-Requested-With' | |
next() | |
# Cut off OPTIONS requests and just send true as response | |
handleOptionsMethod = (req, res, next) -> | |
return res.send(200) if req.method == 'OPTIONS' |
This file contains hidden or 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
// Note-- @interface ContainingViewController : UIViewController <UINavigationControllerDelegate, UITabBarControllerDelegate> | |
-(void) setUpNav { | |
// create tab bar controller and array to hold the view controllers | |
UITabBarController *tabBarController = [[UITabBarController alloc] init]; | |
[tabBarController.view setFrame:CGRectMake(0, 0, 300, 100)]; | |
NSMutableArray *localControllersArray = [[NSMutableArray alloc] initWithCapacity:1]; | |
UIViewController *view1 = [[UIViewController alloc] init]; |
This file contains hidden or 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
var FeedCat = function () { | |
this.cat = 'Garfield'; | |
this.feed = function (scope_) { | |
var scope = scope_; | |
var feedIt = function (food) { | |
scope.doFeed(food); | |
} |
This file contains hidden or 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 | |
declare -A hosts | |
hosts[site1]=200 | |
hosts[site2]=201 | |
default=${hosts[site1]} | |
if [ $1 ] | |
then |