Skip to content

Instantly share code, notes, and snippets.

View ikennaokpala's full-sized avatar
🎯
Focusing

Ikenna N. Okpala ikennaokpala

🎯
Focusing
View GitHub Profile
@ikennaokpala
ikennaokpala / declare-function.el
Created August 5, 2011 12:11
declare-function in emacs
(or (fboundp 'declare-function)
;; taken from Emacs 22.2, not present in 22.1:
(defmacro declare-function (&rest args)
"In Emacs 22, does nothing. In 23, it will suppress byte-compiler warnings.
This definition is so that packages may take advantage of the
Emacs 23 feature and still remain compatible with Emacs 22."
nil))
@ikennaokpala
ikennaokpala / sbt_dependency
Created August 5, 2011 13:35
sbt_dependency_problem
Getting org.scala-tools.sbt sbt_2.8.1 0.7.4 ...
:: problems summary ::
:::: WARNINGS
module not found: org.scala-tools.sbt#sbt_2.8.1;0.7.4
==== local: tried
/Users/iokpala/.ivy2/local/org.scala-tools.sbt/sbt_2.8.1/0.7.4/ivys/ivy.xml
@ikennaokpala
ikennaokpala / mysql_via_brew.sh
Created August 6, 2011 12:26
mysql via brew
ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)" #install brew
brew install mysql
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
sudo cp /usr/local/Cellar/mysql/5.5.10/com.mysql.mysqld.plist /Library/LaunchDaemons/
@ikennaokpala
ikennaokpala / meta_multiplier.rb
Created August 6, 2011 13:31
meta_multiplier
class Multiplier
def self.make_multiplier(n)
define_method("times_#{n}") do |val|
val * n
end
end
100.times do |n|
make_multiplier(n)
@ikennaokpala
ikennaokpala / google_jsapi.haml
Created September 24, 2011 21:09
load google JSAPI with HAML
!!!
%html
%head
%title
= csrf_meta_tag
= stylesheet_link_tag "layout"
%script{:src=>"http://www.google.com/jsapi", :type=>"text/javascript"}
%script{:type=>"text/javascript"}
google.load("chrome-frame", "1.0.2");
google.load("dojo", "1.6.1");
@ikennaokpala
ikennaokpala / google_jsapi_check.js
Created October 3, 2011 01:47
google jsapi load check
<% extras = ::Rails.env == "development" ? "{ uncompressed: true }": "{}" %>
if (typeof google === 'undefined' || google == "" ) {
scriptTag = createScriptTag();
insertScriptTag(scriptTag);
console.dir(this)
} else {
google.load("jquery", "1.6.4", <%= extras %>);
google.load("jqueryui", "1.8.0", <%= extras %>);
}
@ikennaokpala
ikennaokpala / search.html
Created October 23, 2011 11:05
simple search box
<form action="#" id="searchform" method="post" name="searchform">
<input class="field" id="searchtxt" name="searchtxt" size="" tabindex="" type="" value="Search" style="width: 70px; ">
<input class="bt_go" id="submitbtn" name="submitbtn" size="" tabindex="" type="submit" value="">
</form>
@ikennaokpala
ikennaokpala / class_methods.rb
Created November 29, 2011 21:53
ruby module include scope
module A
METHODS = [:mix_me]
def self.included(base)
base.send(:include, A::B)
end
module B
def hello(name)
puts "HELLO #{name}"
end
@ikennaokpala
ikennaokpala / gist:1427178
Created December 3, 2011 13:54 — forked from GiaoGiaoCat/gist:1393770
Steps to install RVM + Ruby 1.9.2 + Rails + nginx + Passenger on CentOS (tested on v5.5)
# Steps to install RVM + Ruby 1.9.2 + Rails + nginx + Passenger on CentOS (tested on v5.5)
# Install git and curl, if not already installed
sudo yum install git
sudo yum install curl
# Create the rvm group and add any users who will be using rvm to the group
sudo su -
groupadd rvm
@ikennaokpala
ikennaokpala / nginx.sh
Created December 3, 2011 14:06
nginx start up
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon