- Install homebrew.
brew install rbenv ruby-build
echo 'eval "$(rbenv init -)"' >> $HOME/.bash_profile
rbenv install 2.2.0
rbenv global 2.2.0
rbenv rehash
gem install bundler rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
co = checkout | |
tagsbydate = for-each-ref --sort=-taggerdate --format='%(refname:short)' refs/tags | |
previoustag = !sh -c 'git tagsbydate --count 2 | cut -f2 | sed -n 2p' | |
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -- | |
markdownlog = log --color --pretty=format:'* %s `%Cred%h%Creset` - %C(bold blue)[%an](mailto:%ae)%Creset' --abbrev-commit --dense --no-merges --reverse | |
releasenotes = !sh -c 'git markdownlog ...`git previoustag`' | |
tree = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --decorate" | |
fix = "commit --amend -C HEAD" | |
di = "diff --color" |
In this article, I'll walk through a basic Rails (3.2.x) setup for creating a nested resource for two models. Nested resources work well when you want to build out URL structure between two related models, and still maintain a RESTful convention. This code assumes you are running RVM to manage Ruby/Gem versions, and Git for version control.
$ mkdir family # create rvm gemset
$ echo "rvm use --create ruby-1.9.2@family" > family/.rvmrc
$ cd family # install rails
$ gem install rails # create new rails project
$ rails new . # version control
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :assets do | |
desc "Display asset path" | |
task :paths => :environment do | |
Rails.application.config.assets.paths.each do |path| | |
puts path | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# transcode-video.sh | |
# | |
# Copyright (c) 2013-2014 Don Melton | |
# | |
about() { | |
cat <<EOF | |
$program 4.0 of October 23, 2014 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# transcode-video.sh | |
# | |
# Copyright (c) 2013-2014 Don Melton | |
# | |
about() { | |
cat <<EOF | |
$program 4.0 of October 23, 2014 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang=en> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="verify-v1" content="91yIG+EaOdwKuPX+R9ChHEWVXJ6wdQsq0gqD1c1sbaY="/> | |
<title>David Shapiro, Resume- Web Developer</title> | |
<style type="text/css"> | |
body{font-family:Geneva, Arial, Helvetica, sans-serif;font-size:12px;font-weight:normal;color:#000000;text-align:center;margin:0;padding:0;line-height:1.5em;} | |
header, section, article{display:block;} | |
header{text-align:center;position:relative;z-index:1;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# | |
# Update the path to your lease file below | |
use strict; | |
use File::Copy; | |
#use DateTime; | |
#always parse a copy not the live file | |
#my $leasefile = '/var/lib/dhcpd/dhcpd.leases'; | |
my $leasefile = '/var/lib/dhcp/db/dhcpd.leases'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/ping' | |
@icmp = Net::Ping::ICMP.new('142.40.81.34') | |
rtary = [] | |
pingfails = 0 | |
repeat = 5 | |
puts 'starting to ping' | |
(1..repeat).each do | |
if @icmp.ping |
OlderNewer