Skip to content

Instantly share code, notes, and snippets.

@pzula
pzula / README.md
Created January 6, 2013 23:58 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@pzula
pzula / geo_area.json
Created June 13, 2013 17:16
Area codes with Lat/Long json file
{"date_updated": "2012-04-18", "area_codes": [{"area_code": 201, "city": "Jersey city, NJ", "lat": 40.728157499999988, "lng": -74.077641700000001}, {"area_code": 202, "city": "Washington, DC", "lat": 38.895111800000002, "lng": -77.036365799999999}, {"area_code": 203, "city": "New Haven, CT", "lat": 41.308152700000001, "lng": -72.9281577}, {"area_code": 204, "city": "Winnipeg, MB", "lat": 49.8833, "lng": -97.1500}, {"area_code": 205, "city": "Birmingham, AL", "lat": 33.520660800000002, "lng": -86.802489999999992}, {"area_code": 206, "city": "Seattle, WA", "lat": 47.606209499999999, "lng": -122.3320708}, {"area_code": 207, "city": "Portland, ME", "lat": 43.661471000000013, "lng": -70.255325900000003}, {"area_code": 208, "city": "Boise, ID", "lat": 43.613739000000002, "lng": -116.237651}, {"area_code": 209, "city": "Modesto, CA", "lat": 37.639097199999988, "lng": -120.9968782}, {"area_code": 210, "city": "San Antonio, TX", "lat": 29.424121899999999, "lng": -98.493628199999989}, {"area_code": 212, "city": "New Yo
@pzula
pzula / anagram.rb
Last active December 25, 2015 07:19
Anagram shenanagins
class Anagram
attr_reader :starting_word
def initialize(starting_word)
@starting_word = starting_word
end
def starting_letters
starting_word.chars
@pzula
pzula / bike-depot-scraper.rb
Created October 28, 2013 21:54
Nokogiri find content in page
require 'nokogiri'
require 'open-uri'
url = "http://www.thebikedepot.org/index.php/about"
page = Nokogiri::HTML(open(url))
page.css('#content-w2').select do |element|
puts
puts element.to_html
end
@pzula
pzula / bash_profile
Created October 29, 2013 02:16
bash_profile
# show full path after user
# export PS1='\u@\H:\w$ '
# add git branch to your terminal & other fun stuff
export PS1="\u \[\033[33;1m\]\w\[\033[32m\]\$(parse_git_branch)\[\033[00m\] ✨ "
# open mou on command in Terminal
alias mou="open /Applications/Mou.app"
# make ls pretty
export CLICOLOR=1
# ls colors with light blue, yellow, green
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
@pzula
pzula / Hamming.rb
Last active December 27, 2015 09:29
Hamming in Exercism
class Hamming
attr_accessor :mutation_count
def self.compute(original_dna, mutated_dna)
unless original_dna.length == mutated_dna.length
length_adjuster([original_dna, mutated_dna])
else
@original = original_dna.chars
@mutated = mutated_dna.chars
end
@pzula
pzula / .vimrc
Created November 13, 2013 18:22
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <[email protected]>
" Last change: 2008 Dec 17
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
" for OpenVMS: sys$login:.vimrc
@pzula
pzula / players.rb
Created November 25, 2013 01:27
Scrabble players
require './lib/scrabble'
class Player
attr_reader :name, :letters
def initialize(name)
@name = name
@store = []
@letters = []
gem 'minitest'
require 'minitest/autorun'
require 'minitest/pride'
class Numeral
def self.convert(number)
accumulator, number = reduce_by("", number, 20, "XX")
accumulator, number = reduce_by(accumulator, number, 10, "X")
accumulator, number = reduce_by(accumulator, number, 5, "V")
(1..number).inject(accumulator) { |product| product << "I" }
@pzula
pzula / rvm-output
Created March 11, 2014 00:02
RVM output
pzula checkerboard (master) ✨ rvm reinstall 2.1.1 --debug
2.1.1 - reinstall
Log prefix: /Users/pzula/.rvm/log/1394495351_ruby-2.1.1/
Log filesystem: local,
Log max name length: 250
Log file: /Users/pzula/.rvm/log/1394495351_ruby-2.1.1/remove.src.log
[2014-03-10 19:49:11] __rvm_rm_rf
__rvm_rm_rf ()
{
__rvm_rm_rf_verbose "$@"