Skip to content

Instantly share code, notes, and snippets.

View adamhunter's full-sized avatar

Adam Hunter adamhunter

View GitHub Profile
1) Put terminal_clone_tab.sh somewhere in
your path and make sure it is executable
chmod u+x terminal_clone_tab.sh
2) Then add the following alias (~/.bash_profile or something)
alias nt='terminal_clone_tab.sh'
3) Then you can hit nt (for new tab) anywhere
and a new tab will open up in same directory.
If there is an easier way to do this, let me know [email protected].
// javascript only implementation for document.write in an ajax call
<div class="re-write"></div>
<script type="text/javascript">
document.write = function(text) {
$('.re-write:last').html(text)
}
</script>
// handy rails form posting with authenticity token
$.post($this.attr('href'), {
'_method' : 'delete',
'authenticity_token' : $('form:first input[name=authenticity_token]').val()
}, null, 'script')
require 'rubygems'
require 'feedzirra'
require 'httparty'
class GithubFeed
include HTTParty
class Parser < HTTParty::Parser
SupportedFormats = {'application/atom+xml' => :atom}
apt-get build-dep git-core
# RSpec
require 'spec/expectations'
# Webrat
require 'webrat'
require 'test/unit/assertions'
World(Test::Unit::Assertions)
Webrat.configure do |config|
# after installing all the deps in http://articles.serenity.de/compiling_php_with_oracle/ run (you may also have to patch iconv, instructions are also on that page).
./configure --prefix=/usr/local/php5 --with-iconv=/usr/local --with-apxs2=/usr/local/apache2/bin/apxs --enable-pdo --with-gd --with-zlib --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-libxml-dir=/usr/local --with-curl --with-mcrypt --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql=/usr/local/mysql --with-mhash --with-libxml-dir=/usr/local --with-t1lib=/usr/local --with-xsl --with-freetype-dir=/usr/local --with-gettext --with-bz2=/usr --with-openssl=/usr --enable-bcmath --enable-calendar --enable-cgi --enable-exif --enable-ftp --enable-gd-native-ttf --enable-mbstring --enable-soap --enable-sqlite-utf8 --enable-cli --enable-wddx --enable-zip --with-xmlrpc --with-apxs2=/usr/sbin/apxs
export EXTRA_CFLAGS="-lresolv"
make
sudo make install
In response to all the responses to:
http://twitter.com/rtomayko/status/1155906157
You should never do this in a source file included with your library,
app, or tests:
require 'rubygems'
The system I use to manage my $LOAD_PATH is not your library/app/tests
#!/usr/bin/env ruby
require 'test/unit'
module Hi
def say_hi
'hi'
end
end
@adamhunter
adamhunter / ruby-riak
Created February 19, 2010 14:34 — forked from bigfleet/ruby-riak
#!/bin/bash
# On OS X? Installed homebrew already? Interested in Riak? Get familiar!
# This command in your terminal should be a one-stop shop.
# curl http://gist.github.com/raw/308745/107168665a46decd540dd1c5d50ccdd82eb01051/ruby-riak | sh
brew install erlang wget
curl http://bitbucket.org/basho/riak/get/riak-0.8.tar.gz | tar zx
cd riak && make all rel
cd rel/riak && bin/riak start
wget http://bitbucket.org/basho/riak/raw/67c55dfd44f5/client_lib/jiak.rb