Skip to content

Instantly share code, notes, and snippets.

@sbussard
sbussard / minecraft-skydive.py
Last active Sep 30, 2017
skydiving in minecraft with teachcraft
View minecraft-skydive.py
from mcpi import minecraft
from mcpi import block
from minecraftstuff import MinecraftTurtle
from random import randint
import time
import os.path, sys
mc = minecraft.Minecraft.create(address="158.69.221.37", name="steve")
block_air = 0
@sbussard
sbussard / aws-cognito-authentication-demo.babel.js
Created Dec 30, 2016
how to authenticate an aws cognito user in the browser
View aws-cognito-authentication-demo.babel.js
import AWS from 'aws-sdk/global';
import S3 from 'aws-sdk/clients/s3';
import {
AuthenticationDetails,
CognitoUser,
CognitoUserPool,
} from 'amazon-cognito-identity-js';
const REGION = 'some-string-value';
const USER_POOL_ID = 'some-string-value';
@sbussard
sbussard / gist:7796aac53012a40bf26a1d13135c8ee2
Created Aug 26, 2016
A list of things, and something to do
View gist:7796aac53012a40bf26a1d13135c8ee2
Let's say you have a list of items, and something to do with each item. You want to be able to tell the system when to do the thing on an item, and to be able to select what item to do the thing on. For convenience sake, you want to be able to choose the next item or the previous item, or any item in the list (by index of course).
The difference between this and a reducer, for example, is that this system provides an interface for outside interaction.
Right now the class assumes that the list of items are dom elements, children of some parent element, and the task to be applied is toggling a css class. This is already useful for a wide variety of applications, including carousels, image sliders and slide shows. But essentially it only works on the front end.
@sbussard
sbussard / push.sh
Last active Jul 12, 2016
push build output to github pages
View push.sh
#!/usr/bin/env bash
BUILD_DIR=build
git checkout -b _build_staging_
git add -f $BUILD_DIR
git commit -am add_build_ouput
git subtree split --prefix $BUILD_DIR -b gh-pages
git push origin gh-pages -f
git checkout -
@sbussard
sbussard / svg-filter-dropshadow-right.svg
Created Jun 23, 2016
svg-filter-dropshadow-right.svg
View svg-filter-dropshadow-right.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View confirm
# Add this to ~/.profile or ~/.bashrc or whatever
# ask for a confirmation before executing the following command
confirm() {
read -r -p "Are you sure? [y/N] " response
[[ $response =~ ^([yY][eE][sS]|[yY])$ ]] && $@
}
export alias c=confirm
@sbussard
sbussard / estimator.css
Last active Dec 31, 2015
Cost Estimator App
View estimator.css
* {
box-sizing: border-box;
}
body {
font-family: sans-serif;
margin: 0;
padding: 0;
background-color: #f0f0f0;
}
#logo {
@sbussard
sbussard / img2canvas.js
Created Oct 12, 2013
Converts all images on a page to canvas of images
View img2canvas.js
// requires jQuery obviously
$(function(){
$('img').each(function(i, img){
var $img = $(img);
var url = $img.attr('src');
var w = $img.width();
var h = $img.height();
var canvas = $('<canvas data-image="'+i+'"></canvas>').attr({ width: w, height: h });
$(img).replaceWith(canvas);
@sbussard
sbussard / meta.json
Created Jun 13, 2013
if all meta information was stored in a meta file it would be one step closer toward a more semantic web. meta.json could replace all html meta tags, robots.txt, humans.txt, and add the ability to map pages to ontologies through the use of selectors.
View meta.json
// created for apple.com/contact
"{
'language': 'en-us',
'charset': 'utf-8',
'author': 'Apple Inc.',
'omni_page': 'How to Contact Us',
'publish-date': 'May 12, 2013',
'sitemap': 'http://www.apple.com/sitemap',
'shortcut-icon': 'http://www.apple.com/favicon.ico',
'viewport': 'width=1024',
View .profile
# add this line at the end of the file
python ~/.psam.py
You can’t perform that action at this time.