Skip to content

Instantly share code, notes, and snippets.

View QuintinAdam's full-sized avatar
:shipit:

Quintin Adam QuintinAdam

:shipit:
View GitHub Profile
@QuintinAdam
QuintinAdam / db.rake
Created October 18, 2016 01:08 — forked from hopsoft/db.rake
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
class HomeScreen < PMWebScreen
uses_action_bar false
title "Web View"
stylesheet HomeScreenStylesheet
def on_load
@current_url = 'https://www.tacobell.com'
open_url(@current_url)
end
source 'https://rubygems.org'
ruby '2.2.2'
gem 'rails', '~> 4.2.1'
gem 'pg'
gem 'puma'
gem 'devise'
gem 'figaro'
@QuintinAdam
QuintinAdam / .powenv
Last active August 29, 2015 14:22 — forked from beneggett/.powenv
# detect `$rvm_path`
if [ -z "${rvm_path:-}" ] && [ -x "${HOME:-}/.rvm/bin/rvm" ]
then rvm_path="${HOME:-}/.rvm"
fi
if [ -z "${rvm_path:-}" ] && [ -x "/usr/local/rvm/bin/rvm" ]
then rvm_path="/usr/local/rvm"
fi
# load environment of current project ruby
if
class @GoogleAnalytics
@load: ->
# Google Analytics depends on a global _gaq array. window is the global scope.
window._gaq = []
window._gaq.push ["_setAccount", GoogleAnalytics.analyticsId()]
# Create a script element and insert it in the DOM
ga = document.createElement("script")
ga.type = "text/javascript"
user = User.find_or_create_by!(email: "example@example.com") do |user|
user.password= '12345678'
user.password_confirmation= '12345678'
end
puts "created #{user.email}"
25.times do
photo = open("http://placekitten.com/g/#{Random.rand(300..600)}/#{Random.rand(300..600)}")
photo = user.pictures.create(title: 'Awesome Cat', description: 'Awesome Cat Description', photo: photo, category: 'Cat')
puts "created cat photo for #{user.email}"

#fix git

$ git credential-osxkeychain erase
host=github.com
protocol=https
[hit return]
@QuintinAdam
QuintinAdam / GameOfLife.markdown
Last active June 30, 2019 23:21
Conway's Game of Life

#Conway's Game of Life

###Goal

  • Create a program based on the rules of Conway's Game of Life.

###Basics

  • The goal of the program will be to track the changes of 'cells'.
  • Cells can ether be 'Alive' or 'Dead'.