Skip to content

Instantly share code, notes, and snippets.

View brettchalupa's full-sized avatar

Brett Chalupa brettchalupa

View GitHub Profile
@brettchalupa
brettchalupa / favorite_sort.rb
Created September 19, 2012 22:18
Sorting and displaying Submissions and their Favorite count
@submissions = Submission.all.sort_by { |s| s.favorites.count }
File.open("favorites_list.txt", "w") do |file|
@submissions.each do |submission|
file << submission.name + " - Favorites: " + submission.favorites.count.to_s + "\n"
end
end
@brettchalupa
brettchalupa / http_write.rb
Created October 11, 2012 22:00
Write an HTTParty GET request to a file.
File.open( "/tmp/my_movie.mov", "w") do |movie|
movie << HTTParty.get( "http://example.com/movie.mov" )
end
@brettchalupa
brettchalupa / bdb.haml
Created October 12, 2012 15:36
Pulling in the bday bash game.
%iframe#gameframe{:frameborder => "no", :height => "540", :onload => "this.contentWindow.focus();", :scrolling => "no", :src => "http://azurenimbus.com/aetherarcade/index.html", :style => "padding:0;margin:0;border:1px;", :width => "640"}
@brettchalupa
brettchalupa / output_users.rb
Created October 15, 2012 15:53
Write BMO users to a txt file.
@users = User.all
File.open("user_list.txt", "w") do |file|
@users.each do |user|
file << user.id
file << " "
file << user.name
file << "\n"
end
end
@brettchalupa
brettchalupa / Makefile
Created October 20, 2012 02:04
Makefile for compiling AS3 into SWFs.
MXMLC = ~/../../Library/flex_sdk_4.6.0.23201B/bin/mxmlc
SRC = src/
MAIN = src/Main.as
SWF = bin/file_name.swf
$(SWF) : $(SRC)
$(MXMLC) -o $(SWF) -static-link-runtime-shared-libraries -- $(MAIN)
run : $(SWF)
open $(SWF)
@brettchalupa
brettchalupa / usage.js
Created October 20, 2012 17:02
aliceffekt's jquery visible image script
$(window).scroll(function () { visibleImg(); });
@brettchalupa
brettchalupa / random_game.rb
Last active December 11, 2015 12:19
A fun little game in Ruby for guessing a number between 1 and 100 (inclusive).
class RandomGame
def play
in_game = true
while in_game
puts "Guess a number between 1 and 100 (inclusive)."
random_number = generate_random
print "> "
guess = gets.chomp.to_i
@brettchalupa
brettchalupa / user.json
Last active December 12, 2015 02:39
Sublime Text 2 config
{
"color_scheme": "Packages/Color Scheme - Default/Twilight.tmTheme",
"font_face": "Monaco",
"font_size": 16,
"draw_white_space": "selection",
"tab_size": 2,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"hot_exit": false,
"remember_open_files": false,
@brettchalupa
brettchalupa / gam_jam_resources.md
Last active December 12, 2015 09:19
a list of game jam resources
@brettchalupa
brettchalupa / developer_resources.md
Last active December 12, 2015 09:19
a list of resources for web application and web site developers. for front-end, back-end and everything in-between.