Skip to content

Instantly share code, notes, and snippets.

View puppybits's full-sized avatar

Bobby puppybits

View GitHub Profile
@puppybits
puppybits / PSD_font_style_ripper.jsx
Last active January 5, 2025 19:21
PSD to CSS web font parser
/*
# Create customized Web Fonts CSS file from a folder of PSDs
1. Edit the root location for the font.
2. Add any mapping you might need/want from Desktop fonts to the webfonts.
3. In Photoshop go to File > Scripts > Browse... and select the fonts.jsx file
4. Select the Folder where you PSDs are.
5. Photoshop scripting is very slow, so wait for it to complete and save a fonts.css file to the location.
## Sample file created:
@puppybits
puppybits / gist
Last active April 10, 2022 21:04
#! /usr/bin/python
#
# Download all your gists locally.
# Change, modify and create new gists offline, then upload to github
#
# How to install:
# curl -O https://gist.github.com/raw/5096082/ac83f7ed9ce57323785291b91c71fd4d6e2c3d42/gist && export GITHUB_USERNAME=xxxxxxx && export GITHUB_PASSWORD=xxxxxxxx
#
# ## Feature Set:
# * list my gists
@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
@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 / 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 / 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 / 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 / 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 / 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 / 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")