Skip to content

Instantly share code, notes, and snippets.

View DiegoSalazar's full-sized avatar

Diego E. Salazar DiegoSalazar

View GitHub Profile
@fnichol
fnichol / README.md
Created March 12, 2011 20:52
Download a cacert.pem for RailsInstaller

Why?

There is a long standing issue in Ruby where the net/http library by default does not check the validity of an SSL certificate during a TLS handshake. Rather than deal with the underlying problem (a missing certificate authority, a self-signed certificate, etc.) one tends to see bad hacks everywhere. This can lead to problems down the road.

From what I can see the OpenSSL library that Rails Installer delivers has no certificate authorities defined. So, let's go fetch some from the curl website. And since this is for ruby, why don't we download and install the file with a ruby script?

Installation

The Ruby Way! (Fun)

@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@leipzig
leipzig / mycd.sh
Created January 21, 2012 03:36
directory based history bash profile
function mycd()
{
#if this directory is writable then write to directory-based history file
#otherwise write history in the usual home-based history file
tmpDir=$PWD
echo "#"`date '+%s'` >> $HISTFILE
echo $USER' has exited '$PWD' for '$@ >> $HISTFILE
builtin cd "$@" # do actual cd
if [ -w $PWD ]; then export HISTFILE="$PWD/.dir_bash_history"; touch $HISTFILE; chmod --silent 777 $HISTFILE;
else export HISTFILE="$HOME/.bash_history";
@bjhess
bjhess / st_cheat.txt
Created January 11, 2012 21:39
Sublime Text Cheatsheet
Navigation:
cmd-p Goto Anything ('@' for functions, ':' for line number)
cmd-r Function finder
ctl-g Goto line number
cmd-sft-p Command palette
cmd-sft-f Find in Files
cmd-opt-r Toggle regex when finding
cmd-opt-# Columns
ctr-# Switch columns
@phawk
phawk / .screenrc
Last active November 8, 2021 01:49
Sample screenrc
# Save this in ~/.screenrc
# Use bash
shell /bin/bash
autodetach on
# Big scrollback
defscrollback 5000
require 'socket'
module EventEmitter
def _callbacks
@_callbacks ||= Hash.new { |h, k| h[k] = [] }
end
def on(type, &blk)
_callbacks[type] << blk
self
@joshnuss
joshnuss / prisoners_dilemma.exs
Last active December 26, 2015 22:59
WIP Prisoner's Dilemma Simulation
# Prisoner's Dilemma
defmodule Scoreboard do
use GenServer.Behaviour
def start do
:gen_server.start_link({:local, :scoreboard}, __MODULE__, [], [])
end
def init do
{:ok, []}