Skip to content

Instantly share code, notes, and snippets.

View rickbacci's full-sized avatar

Rick Bacci rickbacci

View GitHub Profile
@emad-elsaid
emad-elsaid / maze.rb
Created March 27, 2014 14:49
Ruby Maze Generator this is a straight forward of the wikipedia example of a maze generator, the example was written using python, this code is a port of this code in ruby, then i compacted the syntax a little bit to fit in one window :D, that was the hardest part, i had to remove and join some lines and put the algorithm directly in teh draw me…
#!/usr/bin/env ruby
# Author : Emad Elsaid (https://github.com/blazeeboy)
require 'gosu'
include Gosu
DIMENSION, SPLITS, COLOR = 200, 50, Color::GREEN
# credits to: http://en.wikipedia.org/wiki/Maze_generation_algorithm
class GameWindow < Window
def initialize
super DIMENSION, DIMENSION, false, 1000
self.caption = "Maze"
@hopsoft
hopsoft / db.rake
Last active May 4, 2025 19:48
Rails rake tasks for dump & restore of PostgreSQL databases
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}.dump"
end
puts cmd
@fotinakis
fotinakis / cancan_matchers.rb
Last active August 25, 2024 16:44
Custom rspec matcher for testing CanCan abilities
# Custom rspec matcher for testing CanCan abilities.
# Originally inspired by https://github.com/ryanb/cancan/wiki/Testing-Abilities
#
# Usage:
# should have_abilities(:create, Post.new)
# should have_abilities([:read, :update], post)
# should have_abilities({manage: false, destroy: true}, post)
# should have_abilities({create: false}, Post.new)
# should not_have_abilities(:update, post)
# should not_have_abilities([:update, :destroy], post)
@kevinelliott
kevinelliott / osx-10.10-setup.md
Last active March 29, 2025 07:56
Mac OS X 10.10 Yosemite Setup

Mac OS X 10.10 Yosemite

Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

Install Software

@iamjason
iamjason / us-states-array
Created December 29, 2014 01:31
Swift US States Array
let state = [ "AK - Alaska",
"AL - Alabama",
"AR - Arkansas",
"AS - American Samoa",
"AZ - Arizona",
"CA - California",
"CO - Colorado",
"CT - Connecticut",
"DC - District of Columbia",
"DE - Delaware",
@jerodsanto
jerodsanto / Rakefile
Created January 10, 2015 16:51
A code dump showing how we generate "The Changelog Weekly" using the Trello API
require "rubygems"
require "bundler"
require_relative "lib/importer"
Bundler.setup
desc "Import from Trello board"
task :import do
Importer.new(File.dirname(__FILE__)).import ENV["ISSUE"]
end
@JoshCheek
JoshCheek / object_model_challenges.rb
Last active February 12, 2016 21:14
object_model_challenges.rb
# Uncomment lines with `# =>` at the end,
# Predict the result.
# To see if your prediction is correct, run it with:
# vim: `\n` , NOT `\b` (if your leader is not `\`, then use that leader instead)
# atom: `command + option + n`, NOT `b`
# ===== Toplevel methods are defined where? =====
def rawr!
"#{self} says: rawr!"
@cannikin
cannikin / README.md
Last active March 28, 2019 16:08
Typical Ruby on Rails AWS Server Setup

Typical Ruby on Rails AWS Server Setup

You should be able to start a fresh EC2 instance of Ubuntu and follow the instructions below to get a server with your preferred version of Ruby, nginx ready to delegate requests to Unicorn, and logrotate setup to keep your disk from filling up with log files. You will also have ruby-install for installing new rubies and chruby for switching between them. A .ruby-version file will be added to the home directory of the user that runs this script.

Install

  1. Start an EC2 instance using the latest Ubuntu image (as of 2015-06-18 ami-5189a661 for EBS, 64-bit SSD)
  2. Copy the config files below into /tmp using the file names specified in the title.
  3. Edit /tmp/setup.sh and change the variables at the top to match your setup
  4. Make /tmp/setup.sh executable: chmod +x /tmp/setup.sh
@mars888
mars888 / config.el
Last active July 3, 2017 22:17
Quick and dirty Spacemacs configuration layer for Tide and TypeScript
(spacemacs|defvar-company-backends typescript-mode)
@rickbacci
rickbacci / foo.md
Last active August 29, 2015 14:26
Idea #3 for personal project

[FooBr]

Pitch

Work when you want. Help when you want it.

Problem

People often have small problems that they need fixed, or some quick advice. Setting up a meeting with a developer takes time. Conversely, it would be neat to 'work when you want to' kinda like Uber for programmers.