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
#include <stdio.h> | |
unsigned long largest_prime_factor(n) { | |
return n; | |
} | |
int main() { | |
unsigned long n = 600851475143; | |
printf("The largest prime factor of %lu is %lu\n", largest_prime_factor(n), n); | |
return 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
# gem | |
require 'nokogiri' | |
# stdlib | |
require 'open-uri' | |
require 'csv' | |
puts "== SCRAPING" | |
doc = Nokogiri::HTML(open('http://hobbsc.sdf-us.org')) |
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
require 'rubygems' | |
# Set up gems listed in the Gemfile. | |
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) | |
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) |
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
medium.models.netsuite_connection=> medium.models.netsuite_connection=> (fetch-saved-search netsuite authstr "1364") | |
"error code: JS_EXCEPTION\nerror message:Invalid data format. You should return TEXT." |
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
The five rules of Socialism: | |
(1) Don't think. | |
(2) If you do think, don't speak. | |
(3) If you think and speak, don't write. | |
(4) If you think, speak and write, don't sign. | |
(5) If you think, speak, write and sign, don't be surprised. | |
-- being told in Poland, 1987 |
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 | |
def path_maker(name, path) | |
input_array = path.split | |
defstring = "/def #{name} = " | |
path = [] | |
input_array.each do |step| | |
if step[0].match(/\d/) | |
s = split_step(step) |
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
= form_for [@company] do |f| | |
.field | |
= f.label "Name" | |
= f.text_field :name | |
.form-submit | |
= f.submit nil, :class => 'btn btn-large btn-primary' |
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
[21:59][christopher@ryleh:~/Downloads/chruby-0.2.1]$ make install | |
fatal: Not a git repository (or any of the parent directories): .git | |
for dir in `find {etc,lib,bin,sbin,share} -type d 2>/dev/null`; do install -d /usr/local/$dir; done | |
for file in `find {etc,lib,bin,sbin,share} -type f 2>/dev/null`; do install $file /usr/local/$file; done | |
install -d /usr/local/share/doc/chruby-0.2.1 | |
cp -r doc/* *.{md,tt,txt} /usr/local/share/doc/chruby-0.2.1/ 2>/dev/null || true |
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
DEBUG = true | |
def debug(msg, obj = nil) | |
msg = ("== DEBUG: #{msg}") unless (msg.class != String) | |
$stderr.puts msg if DEBUG | |
$stderr.puts obj if (DEBUG && obj != nil) | |
end |
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
s = "spam eggs ham" | |
s.split(" ").last(2).join(" ") | |
# => "eggs ham" | |
s.gsub(/^\S+\s*/, "") | |
# => "eggs ham" |