Skip to content

Instantly share code, notes, and snippets.

Avatar

kik oelmekki

  • society
  • earth
View GitHub Profile
View test.rb
#!/usr/bin/env ruby
require 'socket'
Host = 'google.com'
Port = 80
socket = TCPSocket.new( Host, Port )
socket.puts "GET /"
socket.readlines.each do |line|
p line
end
View .irbrc
# ~/.irbrc
unless IRB.conf[:LOAD_MODULES].include?('irb/completion')
IRB.conf[:LOAD_MODULES] << 'irb/completion'
end
View env.rb
# in order to be able to do in step definitions :
# webrat_session.page.should have_selector( css3_selector )
module WWW
class Mechanize
class Page
def has_selector?( selector )
not search( selector ).empty?
end
end
end
View Rakefile
require 'cucumber/rake/task'
def foo
puts "foo"
end
Cucumber::Rake::Task.new( :features ) do |t|
foo
end
View timetracker.vim
if exists('trackloaded')
finish
endif
" list of autocmd events:
" http://www.vim.org/htmldoc/autocmd.html#autocmd-events
let trackfile = '/tmp/timetrack.dat'
let trackloaded = 1
execute 'autocmd InsertEnter * call Track("begin")'
View env.rb
require 'spec'
require 'rubygems'
require 'webrat'
require "#{File.dirname(__FILE__)}/logger"
# default object is the session object
def method_missing(name, *args, &block)
if webrat_session.respond_to?(name)
webrat_session.send(name, *args, &block)
View fx2.js
(function($)
{
/**
* Get a cookie
* @param string
* @return string
*/
function getCookie( name )
{
var nameEQ = name + "=";
View fx2.js
(function($)
{
/**
* Get a cookie
* @param string
* @return string
*/
function getCookie( name )
{
var nameEQ = name + "=";
View tab_alternate.vim
" File: tab_alternate.vim
" Author: Olivier El Mekki
" Email: olivier@el-mekki.com
" Description: script allow to switch to the last seen tab, as the screen C-a a
" Usage:
" :Tabalter - go to the last seen tab
if exists('tab_alternate_plugin')
finish
endif