Skip to content

Instantly share code, notes, and snippets.

View delianides's full-sized avatar

Drew Delianides delianides

View GitHub Profile
@delianides
delianides / ago.php
Created February 12, 2011 06:48
Modified version of CSS Tricks time ago function to better support ajax.
<?php
function ago($time)
{
$periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade");
$lengths = array("60", "60", "24", "7", "4.35", "12", "10");
$now = time();
$difference = $now - $time;
@delianides
delianides / hack.sh
Created April 4, 2012 14:02 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@delianides
delianides / .bash_alias
Created April 13, 2012 17:39 — forked from seangaffney/.bash_alias
HAWTEST BASH PROFILE EVAR
alias lls='ls -lha'
alias ~='cd ~'
alias reload="source ~/.bash_profile"
alias pyserver="python -m SimpleHTTPServer"
# Projects
alias cdb1="cd ~/Sites/blah1"
alias cdb2="cd ~/Sites/blah2"
@delianides
delianides / chef_solo_bootstrap.sh
Created April 25, 2012 18:46 — forked from ryanb/chef_solo_bootstrap.sh
Bootstrap Chef Solo
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -xvzf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125/
./configure --prefix=/usr/local
make
make install
@delianides
delianides / chef_solo_bootstrap.sh
Created April 25, 2012 18:46 — forked from ryanb/chef_solo_bootstrap.sh
Bootstrap Chef Solo
#!/usr/bin/env bash
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev rsync
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -xvzf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125/
./configure --prefix=/usr/local
make
make install
@delianides
delianides / keys.sh
Created September 17, 2012 18:12
SSH Key Gen
#!/usr/bin/env bash
#cd ~/.ssh;
echo "Changed to SSH dir...What is your email address?"
while read inputline do
echo "\r\r\r" | ssh-keygen -t dsa -C '$inputline'
echo ~/.ssh/id_dsa.pub > ~/Desktop/SendToDrew
end
# memcached requires libevent
cd /usr/local/src
curl -L -O http://cloud.github.com/downloads/libevent/libevent/libevent-2.0.17-stable.tar.gz
tar -xvzf libevent-2.0.17-stable.tar.gz
cd libevent-2.0.17-stable*
./configure
make
sudo make install
# Compile memcached utility
@delianides
delianides / command.sh
Last active December 25, 2015 10:39
Simple log with commit SHA to paste into GFM.
git log --oneline `git describe --tags --abbrev=0`..HEAD --pretty=format:'[%h] %ad | %an | %s' --date=short --no-merges
@delianides
delianides / test.rb
Created March 24, 2014 18:23
Tester
require 'rb-fsevent'
dir = File.expand_path '../..', __FILE__
fsevent = FSEvent.new
fsevent.watch dir do |directories|
puts "Detected change inside: #{directories.inspect}"
end
fsevent.run
@delianides
delianides / trucks.rb
Created May 30, 2014 17:51
Rails Code
class Truck < ActiveRecord::Base
has_many :dumps, dependent: :destroy
validates :username, presence: true
validates :password, presence: true
validates :frequency, presence: true
validates :name, presence: true
attr_accessor :username, :password, :name, :description