Skip to content

Instantly share code, notes, and snippets.

View cmhobbs's full-sized avatar
🍩
Waiting between the walls.

Christopher M. Hobbs cmhobbs

🍩
Waiting between the walls.
View GitHub Profile
#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;
# gem
require 'nokogiri'
# stdlib
require 'open-uri'
require 'csv'
puts "== SCRAPING"
doc = Nokogiri::HTML(open('http://hobbsc.sdf-us.org'))
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'])
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."
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
@cmhobbs
cmhobbs / pathmaker.rb
Created November 25, 2012 06:43
Path Macro Maker for TinyFugue
#!/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)
= form_for [@company] do |f|
.field
= f.label "Name"
= f.text_field :name
.form-submit
= f.submit nil, :class => 'btn btn-large btn-primary'
[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
@cmhobbs
cmhobbs / debug.rb
Created November 13, 2012 17:29
fancy debug method (public)
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
s = "spam eggs ham"
s.split(" ").last(2).join(" ")
# => "eggs ham"
s.gsub(/^\S+\s*/, "")
# => "eggs ham"