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
source :rubygems | |
# We are not loading Active Record, nor Active Resources etc. | |
# We can do this in any app by simply replacing the rails gem | |
# by the parts we want to use. | |
gem "actionpack", "~> 3.2" | |
gem "railties", "~> 3.2" | |
gem "tzinfo" | |
# Let's use thin |
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
#!/bin/bash -l | |
for RUBY in `rvm list strings` | |
do | |
rvm use $RUBY | |
for GEMSET in `rvm gemset list | grep -E '^ ' | grep -v '*'` | |
do | |
rvm --force gemset delete $GEMSET | |
done | |
done |
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
Date: Tue, 30 Sep 2014 16:49:43 +0000 | |
From: Louis Goff-Beardsley <louis@infinitiumglobal.com> | |
To: London Ruby Users Group <chat@lists.lrug.org> | |
Subject: [LRUG] [JOBS] Contracts Galore | |
Message-ID: <48267692359843abb6ad091ab5441d3d@SEHSTE15D2BE3.hs20.net> | |
Content-Type: text/plain; charset="iso-8859-1" | |
Hi LRUG, | |
Just a quick note, the yearly "Just got back from holiday, oh God we need more development done" contracts rush has come and we've been inundated with requests for upper-Mid level & Senior Ruby and/or Javascript contractors. |
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
app = lambda do |env| | |
[301, {'Location' => 'https://www.pensionwise.gov.uk/'}, []] | |
end | |
run app |
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
source 'https://rubygems.org' | |
ruby '2.2.2' | |
gem 'mechanize' |
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
# build go static binary from root of project | |
gostatic(){ | |
local dir=$1 | |
if [[ -z $dir ]]; then | |
dir=$(pwd) | |
fi | |
local name=$(basename "$dir") | |
( | |
cd $dir | |
echo "Building static binary for $name in $dir" |
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 ruby | |
# random_password.rb | |
# generate a random string of 12 alphanumeric characters | |
# Steven Wilkin @stevebiscuit | |
chars = ('0'..'9').to_a + ('A'..'Z').to_a + ('a'..'z').to_a | |
12.times {print chars[rand(chars.length)]} | |
puts |
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
I have a strange problem with a Sinatra app. | |
When I request http://MYAPP.heroku.com/http://google.com | |
This is in the log: | |
$ heroku logs | |
82.24.100.136, 10.250.31.111 - - [27/Oct/2009 13:18:41] "GET /http:/google.com HTTP/1.1" 200 17 0.0005 | |
The '//' in my GET request is being converted to '/' |
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 python | |
for x in range(1, 101): | |
if not(x % 3 or x % 5): | |
print 'FizzBuzz' | |
elif not x % 3: | |
print 'Fizz' | |
elif not x % 5: | |
print 'Buzz' | |
else: |
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 python | |
# sort this list of random numbers using bubble sort algorithm | |
nums = [35, 59, 30, 95, 97, 45, 44, 41, 80, 78, 14, 58, 2, 41, 6, 68, 18, 13, 69, 12] | |
# test if the list is sorted | |
def sorted(arr): | |
prev = arr[0] | |
for x in arr: | |
if x < prev: |
OlderNewer