Skip to content

Instantly share code, notes, and snippets.

View thefonso's full-sized avatar

thefonso thefonso

View GitHub Profile
@briankung
briankung / The Project Euler Sprint Rules.md
Last active December 14, 2017 02:20
The Project Euler Sprint Rules

The Project Euler Sprint Hack Nights

Project Euler Sprint Hack Nights are beginner friendly events where you can work on your own projects or engage in a friendly competition called the Project Euler Sprint.

The Project Euler Sprint is a friendly competition involving solving Project Euler ([http://projecteuler.net][projecteuler]) problems for points. Project Euler is a series of increasingly difficult computational math problems that must be solved with code (generally speaking - we've had some impressive solutions in pen and paper as well as on an Excel spreadsheet).

Each problem is harder than the last, so each problem is worth its problem number in points. Problem #1 is easy, so it's worth 1 point, while problem #50 is much harder, but worth 50 points. You can form teams of 4 people and solutions can be in any language as long as it's coded there. More detailed rules below.

Sprint Rules

@mjansen401
mjansen401 / gist:4588620
Last active December 11, 2015 10:39
Observer pattern example in Ruby, using stocks and stock tickers
class Stock
def initialize(symbol)
@symbol = symbol
@observers = []
end
def register_observer(observer)
@observers << observer
end
@ttscoff
ttscoff / rtftomarkdown.rb
Created October 9, 2012 21:05
Convert RTF/DOC files to Markdown via Textutil
#!/usr/bin/ruby
=begin
Usage: rtftomarkdown.rb FILENAME.rtf
Uses textutil, available on Mac only (installed by default)
Outputs to STDOUT
Notes:
Links are replaced with Markdown references (duplicate links combined).
@redsquirrel
redsquirrel / bowling_score.rb
Created July 15, 2012 00:43
In which I realize that the scoring logic for strikes and spares are the same. (3 consecutive balls)
require 'test/unit'
def score(*frames)
score = roll_count = 0
rolls = frames.flatten
frames.each do |frame|
if sum(frame) == 10
score += sum(next_three(rolls, roll_count))
else
score += sum(frame)
@alhafoudh
alhafoudh / stickies-to-notes.rb
Created July 11, 2012 10:11
OSX 10.8 Mountain Lion - Migrate your stickies from Stickies.app to Notes.app
# Author: Ahmed Al Hafoudh <alhafoudh@freevision.sk
#
# Usage: ruby stickies-to-notes.rb
#
# Prerequisites:
# gem install rb-appscript
#
require 'appscript'
require 'osax'
@mylesmegyesi
mylesmegyesi / gist:2641253
Created May 9, 2012 02:15
Pair with ssh reverse tunneling
# Set up aws server to use as ssh proxy
# open /etc/ssh/sshd_config with sudo
# add 'GatewayPorts yes' anywhere
# restart server
# server: ec2-23-22-46-142.compute-1.amazonaws.com
# server port: 12345
# server user: ubuntu
# host port: 2222
@sirupsen
sirupsen / vim7.3_mac_install.rb
Created July 27, 2011 21:57 — forked from pengwynn/vim7.3_mac_install.rb
Script to install Vim 7.3 with ruby support for Mac OS X Lion
# requires root permissions in /usr/bin/
star = String.new
8.times { star += "*" }
Star = "\n#{star * 3}\n"
def newblock string
puts "\n#{Star}#{string}#{Star}\n"
end
@pengwynn
pengwynn / vim7.3_mac_install.rb
Created July 27, 2011 17:41 — forked from mattsacks/install.rb
Script to install Vim 7.3 with ruby support for Mac OS X Lion
# requires root permissions in /usr/bin/
star = String.new
8.times { star += "*" }
Star = "\n#{star * 3}\n"
def newblock string
puts "\n#{Star}#{string}#{Star}\n"
end
@RSpace
RSpace / Gemfile
Created April 23, 2011 12:49
Running Capybara and RSpec without Rails
source 'http://rubygems.org'
gem 'rspec'
gem 'capybara', :git => 'https://github.com/jnicklas/capybara.git'
gem 'launchy'
gem 'ruby-debug19'