This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iex(26)> [head | tail] = [1,2,3] | |
[1, 2, 3] | |
iex(27)> head | |
1 | |
iex(28)> tail | |
[2, 3] | |
iex(29)> [tail | head] | |
[[2, 3] | 1] | |
iex(30)> [head | tail] | |
[1, 2, 3] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Net; | |
using System.IO; | |
using System.Text; | |
namespace stripe_example | |
{ | |
class MainClass | |
{ | |
public static void Main (string[] args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image = Image.new([[1, 1, 0, 0], | |
[0, 0, 0, 0], | |
[0, 1, 0, 0], | |
[0, 0, 0, 0], | |
[0, 0, 0, 0], | |
[0, 0, 0, 0]]) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Test.assert_equals(Person.new("ian").greet("sam"), "Hi sam, my name is ian") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
apt-get -y update | |
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev libffi-dev | |
cd /tmp | |
wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p195.tar.gz | |
tar -xvzf ruby-2.0.0-p195.tar.gz | |
cd ruby-2.0.0-p195/ | |
./configure --prefix=/usr/local | |
make | |
make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Requires supporting ruby files with custom matchers and macros, etc, | |
# in spec/support/ and its subdirectories. | |
# see this http://stackoverflow.com/questions/357754/can-i-traverse-symlinked-directories-in-ruby-with-a-glob | |
Dir[Rails.root.join("spec/support/**{,/*/**}/*.rb")].each {|f| require f} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#shows ruby version, current dir, current branch | |
export PS1="\[\e[0m\][\$(~/.rvm/bin/rvm-prompt i v g)]\[\e[1;36m\]\$(parse_git_branch)\[\e[0m\]:\W$ \[\e[0;91m\]" | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script type="text/javascript" charset="utf-8"> | |
$(function(){ | |
$('#submit_button').click(function(){ | |
var url = "/post/to/this/url"; | |
$.post(url, $('form').serialize(), function(responseData, ajaxStatus){ | |
//this is the callback function that fires upon completion of the ajax post request | |
//the 'data' parameter holds whatever the server returned in response to to the post request | |
//here, i am assuming the server returns a message that is intended to be displayed to the user ("missing data", "info submitted", etc) |