Skip to content

Instantly share code, notes, and snippets.

View dguzzo's full-sized avatar
🏠
Working from home

Dominick dguzzo

🏠
Working from home
View GitHub Profile
@dguzzo
dguzzo / gif-ify.py
Last active April 6, 2017 02:13
make an animated gif from some images with Wand
#!/usr/bin/env python3
from glob import glob
from wand.image import Image
source_images = glob("S*.png")
TOTAL_FRAMES = len(source_images)
print("animating %i files" % TOTAL_FRAMES )
@dguzzo
dguzzo / gif-ify.rb
Last active October 29, 2016 19:04
make an animated gif from some jpegs with RMagick
#!/usr/bin/env ruby
require "RMagick"
RESIZE = 0.25
DELAY = 10
FILENAME = "quartz-composer-process.gif"
puts "loading image files"
@dguzzo
dguzzo / createColorsDB.py
Last active June 13, 2016 00:44
put some colors from colourlovers.com into a sqlite database
#!/Library/Frameworks/Python.framework/Versions/3.4/bin/python3
# -*- coding: utf-8 -*-
import sqlite3 as lite
from colourlovers import ColourLovers
def getColors():
cl = ColourLovers()
colors = cl.colors()
@dguzzo
dguzzo / cycle.js
Last active August 29, 2015 14:20
great way to cycle values via modulus operator
// see One-time Binding section in Angular docs,
// https://docs.angularjs.org/guide/expression
angular.module('oneTimeBidingExampleApp', []).
controller('EventController', ['$scope', function($scope) {
var counter = 0;
var names = ['Igor', 'Misko', 'Chirayu', 'Lucas'];
/*
* expose the event object to the scope
*/
@dguzzo
dguzzo / .gitignore
Last active April 6, 2017 05:49
.gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@dguzzo
dguzzo / .vimrc
Last active August 29, 2015 14:05
my .vimrc file
syntax on
set nocompatible " be iMproved, required
filetype off " required
set shiftwidth=2 tabstop=2 expandtab
" tell vim to treat numerals as decimal, not octal. (from Practical Vim book,
" pg. 21)
set nrformats=
@dguzzo
dguzzo / node-unix-clipboard.js
Last active August 29, 2015 14:03
simple Node.js execute unix command and copy to clipboard
// inspired by http://www.dzone.com/snippets/execute-unix-command-nodejs
var exec = require('child_process').exec;
var someValue = "contrived: " + 2 * 2;
exec('echo "' + someValue + '" | pbcopy'); // "contrived: 4" is now in your clipboard. WARNING: this is destructive, and an overwrite something important if you're not careful.
@dguzzo
dguzzo / world-cup-doge.rb
Last active October 8, 2016 22:19
World Cup 2014 Doge-y-ness
#!/usr/bin/env ruby
# adapted from a tweet of @jcoglan -- https://twitter.com/jcoglan
%w(such very so much).product(%w(sports goal ref lads)).sample.join(' ') + "!"*rand(1..3)
@dguzzo
dguzzo / mate-gem-source.bash
Last active August 29, 2015 13:58
easily open gem source directory in Textmate
# change "bundler" to the name of any installed gem (run 'gem list' to see which gems are installed.)
# change "mate" to any prefered program that can open a directory. 'open' will open the file tree in Finder on OSX, for instance.
# the regex basically strips off the "/lib/<gem-name>.rb" from the "gem which" output.
gem which bundler | sed "s/\(.*\)\(.*\/.*\/.*\.rb\)$/\1/" | xargs mate
# alternate way
gem which bundler | ruby -e "puts gets.match(/(.*)\/lib\/.*/)[1]" | xargs mate
@dguzzo
dguzzo / sup.rb
Last active October 8, 2016 22:19
say sup, y'all
#!/usr/bin/env ruby
SUP_COUNT = 120
SUP_PADDING = 50
def vertical_pad_message(padding=15)
padding.times {puts "\n"}
yield
padding.times {puts "\n"}
end