Skip to content

Instantly share code, notes, and snippets.

@am
am / shell
Created January 26, 2014 11:35
Kaleidodcope "xcrun: error: cannot be used within an App Sandbox..."
cd /Applications/Kaleidoscope.app/Contents/Resources/Integration/scripts
./install_git-default
require 'pry'
class Animal
def initialize(name)
@name = name
end
def say()
begin
raise NotImplementedError, "something goes wrong"
rescue Exception
puts $!
@ream88
ream88 / Rakefile
Created July 18, 2012 11:24
Minitest rake task
require 'rake'
require 'rake/testtask'
Rake::TestTask.new do |t|
t.test_files = Dir.glob('spec/**/*_spec.rb')
end
task(default: :test)
@KINGSABRI
KINGSABRI / syn-poc.rb
Created June 8, 2012 20:31
Build TCP/IP packet from scratch by ruby , and send syn(or whatever you want) packet
#!/usr/bin/env ruby
# Full Contol on Ethnet, IP & TCP headers. Play with it ;)
# to test it: nc -lvp 4444
# as root: tcpdump -nvvvv 'tcp port 4444' -i wlan0 # change wlan0 to your interface
# or use packetfu to monitor as tcpdump
## cap = PacketFu::Capture.new(:iface => 'wlan0' , :promisc=> true)
## cap.show_live(:filter => 'tcp and port 4444')
# libpcap should be installed
# gem install pcaprub packetfu
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@baopham
baopham / Monaco for Powerline.otf
Last active April 16, 2023 03:57
Patched font Monaco for OSX Vim-Powerline
@matiskay
matiskay / README.md
Created December 29, 2011 21:24 — forked from lenary/partials.rb
Partials on Sinatra + Haml

Partials on Sinatra + Haml

This is the haml version. If you want to use the same with erb just change haml to erb.

How to use it

  • Create you partial form example _form.haml (The underscore at the beginning is really important).
  • In you .haml file just write = partial("form").
@jasoncodes
jasoncodes / gist:1223731
Created September 17, 2011 07:45
Installing Ruby 1.9.3 with rbenv on OS X
# The latest version of this script is now available at
# https://github.com/jasoncodes/dotfiles/blob/master/aliases/rbenv.sh
VERSION=1.9.3-p286
brew update
brew install rbenv ruby-build rbenv-vars readline ctags
if [ -n "${ZSH_VERSION:-}" ]; then
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.zshrc
else
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.bash_profile
@pfleidi
pfleidi / fiberchat.rb
Created February 19, 2011 18:51
A naive socket chat using select() and ruby fibers
require 'rubygems'
require 'socket'
include Socket::Constants
class ChatServer
def initialize
@reading = Array.new
@writing = Array.new
@clients = Hash.new
function random_chinese_name() {
function random(a, l) {
var x = [];
x.push(a[Math.ceil(Math.random() * a.length)]);
while(l > 1) {
x.push(a[Math.ceil(Math.random() * a.length)]);
l--;
}
return x.join("");
}