Skip to content

Instantly share code, notes, and snippets.

View puppybits's full-sized avatar

Bobby puppybits

View GitHub Profile
@puppybits
puppybits / responsiveCheck.py
Created January 16, 2014 00:48
Check web sites at different sizes
# Installation:
# pip install selenium && curl -O http://chromedriver.storage.googleapis.com/2.8/chromedriver_mac32.zip && unzip chromedriver_mac32.zip && mv ./chromedriver /usr/local/bin/chromedriver
# Resources:
# ChromeDriver: https://code.google.com/p/selenium/wiki/ChromeDriver
# ChromeDriver Getting Started: https://sites.google.com/a/chromium.org/chromedriver/getting-started
# Selenium Python: http://selenium-python.readthedocs.org/en/latest/api.html
from selenium import webdriver
@puppybits
puppybits / StatelessModelOptions.md
Last active January 3, 2016 05:29
How should the API look like for stateless templates when using PerfView (https://github.com/puppybits/BackboneJS-PerfView)?

I need to have templates that are stateless for PrefView. This allows the developer to write code faster and the browser can run much faster as well by not having to destory DOM, recreate a string, turn the string into DOM and place it on the document again.

I also want a straight forward way take a value from a backbone model and display something else. The standard use case is for translated text or displaying a date/time in a more readable format. Which option is better?

Template binding

// Model 
Backbone.Model.extend({ date: new Date('01/01/2014') });
@puppybits
puppybits / refactor-requirejs.sh
Created August 15, 2013 21:21
Script to refactor require.js modules by searching the disk for the current folder location and updating the define imports
#!/bin/bash
TFILE="out.tmp.$$"
SOURCE_FOLDER="/full/path/to/my/source"
ROOT_RELATIVE="/full/path/to/root/for/requirejs/"
while read f
do
# get the file name
i=$(basename "$f")
@puppybits
puppybits / radioactive.js
Created July 19, 2013 02:36
inspect and log random objects, functions and json
radioactivate = function(obj)
{
for (var attr in obj)
{
if (typeof obj[attr] === "function")
(function(obj, attr){
var _attr = obj[attr];
obj[attr] = function(){
var input = Array.prototype.slice.call(arguments,0);
var output = _attr.apply(_attr, arguments)
@puppybits
puppybits / CoreData+FreezeDry.h
Last active December 17, 2015 16:29
Core Data FreezeDry. Add Multithreading API to the NSManagedObject to share/pass between threads, with either sync or async GCD dispatch queues.
//
// CoreData+FreezeDry.h
// Streamlines transfering a single core data entity between treads.
// This WILL run SLOW with lots of data.
// Minimize changing threads!
// Use it on single objects.
// Use it as an example to batch transfer a large set of data.
//
// Created by Bobby Schultz on 1/13/12.
//
@puppybits
puppybits / textmate_key_commands.md
Last active December 17, 2015 11:18
TextMate Important Key Commands

TextMate

  • show in file browser - ⌘⌃R

  • find file - ⌘T

  • toggle Soft Wrap - ⌥⌘W

  • Complete the current work - ⎋

  • Increase indent level - ⌥⇥

  • Decrease indent level - ⌥⇧⇥

@puppybits
puppybits / SeriesDate.js
Last active December 17, 2015 05:59
Create a date that iterates on either multiple dates of the month or every X number of days
/*
// EXAMPLES:
var payday = new SeriesDate('DAILY', [14], '1/15/2010')
var gas = new SeriesDate('MONTHLY', [1,15], '1/15/2010')
var electricity = new SeriesDate('MONTHLY', [20], '1/15/2010')
payday.next(); // move to next payday
payday.prev(); // move to previous payday
@puppybits
puppybits / git-p2p.mdown
Last active December 14, 2015 19:48
P2P Git repositories

PC1: Run a micro git server:

git daemon --verbose --base-path=./ --export-all --enable=receive-pack 

PC2: clone with (don't forget the trailing slash):

git clone git://<your-ip>/ <repo_name>

Troubleshooting:

@puppybits
puppybits / http_lesson.mdown
Last active December 14, 2015 19:39
HTTP Quickstart

Understand HTTP w/ AJAX in 15 minutes

Setup

Install pip:

curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python

Install bottle:

sudo pip install bottle
@puppybits
puppybits / pi-start.sh
Last active June 15, 2021 04:24
Raspberry Pi Config and Start up Commands
#! /usr/bin.bash
#
# This is a list of commands used to setup my raspberry pi.
# This setups:
# update pi
# setup wifi usb dongle
# pip + django + virtualenv
# nodejs
# ruby
# vnc