Skip to content

Instantly share code, notes, and snippets.

John linusthe3rd

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am strife25 on github.
  • I am jryding (https://keybase.io/jryding) on keybase.
  • I have a public key whose fingerprint is 0F0E 61AC AD6F BB41 6060 D052 953A 1B0C BB0C 5BB7

To claim this, I am signing this object:

@linusthe3rd
linusthe3rd / aws_creds_export.sh
Last active Sep 1, 2016
Export AWS Credentials into Environment Vars
View aws_creds_export.sh
# If you use multiple AWS environments, change this to your profile name to export a different set of credentials
export AWS_PROFILE=default
export AWS_ACCESS_KEY_ID=$(aws configure get aws_access_key_id)
export AWS_SECRET_ACCESS_KEY=$(aws configure get aws_secret_access_key)
@linusthe3rd
linusthe3rd / gist:432c8354d293d1ad4713
Created Jul 20, 2015
Check if Import/Dependency is Available at Runtime
View gist:432c8354d293d1ad4713
from __future__ import print_function
// ...other dependencies...
try:
import requests
except ImportError:
print('You must install the "requests" package in order to use '
'the sync writer: `pip install requests`')
View gist:ff3a0d28848e19626056
from boto.dynamodb2 import connect_to_region
from boto.provider import Provider
aws_settings_provider = Provider('aws')
def create_connection():
aws_region = # get the AWS region of the EC2 instance
# connect_to_region passes along the named arguments to the DynamoDBConnection class that gets created
return connect_to_region(
View helvetica-neue-desk-interface-reset.css
input[type="submit"],
input[type="reset"],
input[type="button"],
button,
textarea {
font-family: inherit;
-webkit-font-smoothing: inherit;
}
View gist:ae41e2742231579ad4e7
// ...other instantiation logic...
var userID = getIDFromPageURI();
var user = null;
var loadUser = function (id) {
// GET the latest state of the user from the backend
$.get("/api/user" + id)
.done(function (response) {
if (!user) {
View gist:4d2a2538503ff0573ae2
fill(myModel, newData);
// myModel's new value:
// {
// "foo": 1, // the "foo" attribute was not modified
// "bar": "baz"
// }
View gist:6b7be0fc7db361fc998d
merge(myModel, newData);
// myModel's new value:
// {
// "foo": "newValue", // the "foo" attribute has a new value
// "bar": "baz"
// }
View gist:b99601536ffa85a7cdf1
var myModel = {
"foo": 1
}
var newData = {
"foo": "newValue",
"bar": "baz"
}
View exponentialBackoff.js
var attempts = 1;
function createWebSocket () {
var connection = new WebSocket();
connection.onopen = function () {
// reset the tries back to 1 since we have a new connection opened.
attempts = 1;
// ...Your app's logic...
You can’t perform that action at this time.