Skip to content

Instantly share code, notes, and snippets.

View cgrusden's full-sized avatar

Corey G cgrusden

  • Ruby on Rails, iOS, Consulting
  • 100% Remote
View GitHub Profile
@cgrusden
cgrusden / renamer.rb
Created February 15, 2010 00:26
Run this script in the same directory as all the .jpg files you want to rename (the format will be: "photo_00001", "photo_00002", etc..). Requires you to install the Ruby framework, but that's it. If you're on a MAC with OS X, it should already be inst
i = 1
Dir.glob("./**/*.jpg").sort {|a,b| File.stat(a).atime <=> File.stat(b).atime}.each do |f|
new_file = "%s-%07d.jpg" % ["photo", i]
puts "Renaming #{f.to_s} to #{new_file}"
File.rename(f.to_s, new_file)
i+=1
end
@cgrusden
cgrusden / gist:1010796
Created June 6, 2011 18:40
How to not name a branch
$ git branch -a
* fucked
master
remotes/heroku/master
remotes/origin/master
@cgrusden
cgrusden / gist:1603210
Created January 12, 2012 21:22
Auto-select people in Causes.org application
Make this a bookmarklet:
$(".list li .checkbox").each(function() { $(this).click(); }) # but only select the first 25, since thats the max (for now)
Use this page as your test:
http://www.causes.com/causes/93997-animal-cruelty-is-not-art/welcome
@cgrusden
cgrusden / gist:1603349
Created January 12, 2012 21:45 — forked from conraddecker/gist:1603341
Basics for a bookmarklet
javascript: (function () {
_bookmarklet = document.createElement('script');
_bookmarklet.id = 'bookmarklet';
if (document.getElementById(_bookmarklet.id)) {
yimmelet.init();
} else {
_bookmarklet.type = 'text/javascript';
_bookmarklet.src = 'http://assets.domain.com/jsfile.js?x=' + (Math.random());
document.getElementsByTagName('head')[0].appendChild(_bookmarklet);
}
new_script=document.createElement('SCRIPT');
new_script.type='text/javascript';
new_script.src='https://raw.github.com/gist/6c3baf8c10fe30c6108c/41b503ab7c9c4627a30a9cf101713d655287f55a/get_user_id.js?';
document.getElementsByTagName('head')[0].appendChild(new_script);
@cgrusden
cgrusden / parse_cities.rake
Created May 14, 2012 23:18
Latitude & Longitude average string lengths
require 'fastercsv'
desc "Parse city data"
task "cities" do
headers = [:country_code, :ascii_name, :name, :state, :population, :lat, :long]
long_num, lat_num = [], []
FasterCSV.foreach(File.join(File.dirname(__FILE__), "../../", "doc/us_cities.txt"), :headers => headers) do |row|
begin
lat_num << row[:lat].length
long_num << row[:long].length
@cgrusden
cgrusden / gist:2961595
Created June 20, 2012 19:03
Privacy Policy
Privacy Policy
Your privacy is very important to us. Accordingly, we have developed this Policy
in order for you to understand how we collect, use, communicate and disclose and
make use of personal information. The following outlines our privacy policy.
* Before or at the time of collecting personal information, we will identify the
purposes for which information is being collected.
@cgrusden
cgrusden / bookmarklet.js
Created September 11, 2012 07:00
Add images to model mayhem with this bookmarklet-ish
javascript:(function(){
_my_script=document.createElement('SCRIPT');
_my_script.type='text/javascript';
_my_script.src='https://raw.github.com/gist/3696556/5ca9ff6c6c386ea8ca7ed4568abb3f2b33160d98/model_mayhem.js?';
document.getElementsByTagName('head')[0].appendChild(_my_script);
})();
@cgrusden
cgrusden / index.html
Created September 27, 2012 18:55
Save data when a form posts
<script>
$(document).ready(function() {
$('form:first').bind('submit', function() {
search = $(this).find('.input_text').val();
$.get(['https://serveletserve.herokuapp.com/PUBLIC_API_TOKEN_1234/track/twitter/cgrusden/searched_for', search].join("/"));
});
});
</script>
<html>
@cgrusden
cgrusden / cgrusden.txt
Created November 5, 2012 18:33
How do you estimate your User Stories?
In a group of 10 developers, we sit on a Google Hangout and read each User Story in Pivotal, then do paper-rock-scissors on the count of 3 and show how many fingers the story should be estimated. We use the estimate that most people have "thrown".