Skip to content

Instantly share code, notes, and snippets.

View ikennaokpala's full-sized avatar
🎯
Focusing

Ikenna N. Okpala ikennaokpala

🎯
Focusing
View GitHub Profile
<h1>Shorty URL Now!!</h1>
<%= form_for :i_shorty, :url =>"/ishorty", :as => :post do |f|%>
<%= f.label "URL" %>:
<%= f.text_field :long_url %>
<%= f.submit "shorten", :name => "shorten_button", :id => "shorten_button" %>
<% end %>
@ikennaokpala
ikennaokpala / access_token.asp
Created June 4, 2011 23:36
access_token_asp A blast from the past l
<%
Dim app_id, app_secret, token_url, access_token
app_id = "APP_ID"
app_secret = "APP_SECRET"
token_url = "https://graph.facebook.com/oauth/access_token?"&"client_id="&app_id&"&client_secret="&app_secret&"&grant_type=client_credentials"
Function GetTextFromUrl(url)
@ikennaokpala
ikennaokpala / site_scraper.rb
Created June 6, 2011 23:08
scraping site for ticket information
#! usr/bin/env ruby
require "rubygems"
require 'json'
require "open-uri"
require "hpricot"
ticket_details_url = "http://www.wegottickets.com/searchresults/page/1/all"
message_response = ""
@ikennaokpala
ikennaokpala / gist:1034085
Created June 19, 2011 11:19
DATE AND TIME FORMAT CODES
DATE AND TIME FORMAT CODES
To Configure the Date/Time Display:
VIEW → GLOBAL OPTIONS → DISPLAY TAB
TOOLS → GLOBAL OPTIONS → DISPLAY TAB (VER 2.9.X)
Change the Time Format according to the codes listed below.
%a Abbreviated weekday name
%A Full weekday name
%b Abbreviated month name
%B Full month name
%c Date and time representation for your locale
<?
$items = 7;
$incoming = file_get_contents(APP_DOCROOT . "/cache/brainfood.cache.xml");
//$xml = iconv("GB18030", "utf-8", $incoming);
//$simple = simplexml_load_file($xml,'SimpleXMLElement', LIBXML_NOCDATA);
$simple = preg_replace('/[\x00-\x09\x0B\x0C\x0E-\x1F\x7F]/', '', $incoming);
$simple = simplexml_load_string($simple);
?>
@ikennaokpala
ikennaokpala / checkall.js
Created July 6, 2011 11:23
checkall checkbox close to me..
$('.cat_list :checkbox').click(function() {
var $c = this.checked;
$(this).closest('li').find(':checkbox').attr('checked',$c);
});
<!--[if gte IE 9]> <script type="text/javascript"> Cufon.set('engine', 'canvas'); </script> <![endif]-->
@ikennaokpala
ikennaokpala / install_nginx.sh
Created July 17, 2011 23:36
install and start up nginx automaically on a mac
sudo mkdir -p /usr/local/src
sudo curl ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.02.tar.gz
cd /usr/local/src
tar xvzf pcre-8.02.tar.gz
cd pcre-8.02
./configure --prefix=/usr/local
make
sudo make install
type Transformer = Request => Request
object OptimusPrime extends Transformer { def apply(req: Request) = req }
object Megatron extends Transformer { def apply(req: Request) = throw new RuntimeException("Invalid operation!")}
@ikennaokpala
ikennaokpala / bash_git_completions.sh
Created July 29, 2011 12:19
bash git completions
wget https://raw.github.com/git/git/master/contrib/completion/git-completion.bash
mv git-completion.bash ~/.git-completion.bash
cd ~/
vim .profile
#add the following into .profile
# Add git bash completions
source ~/.git-completion.bash
GIT_PS1_SHOWDIRTYSTATE=1