Skip to content

Instantly share code, notes, and snippets.

View jakeboxer's full-sized avatar

Jake Card jakeboxer

View GitHub Profile

New Machine

Here's what I do after I do a fresh install of Lion. Things are sorta grouped by type.

General Config

  1. Run Software Update
  2. Start downloading Xcode
  3. Disable auto-bright and turn brightness all the way up
  4. Enable mouse right click
@jakeboxer
jakeboxer / gist:1353121
Created November 9, 2011 21:31
My .vimrc.local for janus
color vividchalk
" Ignore bad Rails stuff
set wildignore+=test/fixtures/**,vendor/gems/**
set wildignore+=enterprise,repositories
set wildignore+=public/images,public/javascripts/MathJax,tmp
" Show whitespace
set list listchars=trail:.,tab:>.
<ul>
<% @sections.each do |section| %>
<li>
<a href="<%= section_articles_path section %>">
<%= section.name %>
</a>
</li>
<% end %>
</ul>
@jakeboxer
jakeboxer / gist:2513226
Created April 27, 2012 21:06
C string reverse
void reverse(char txt[]) {
int i, j;
char tmp;
for (i = 0, j = strlen(txt) - 1; i < j; ++i, --j) {
tmp = txt[i];
txt[i] = txt[j];
txt[j] = tmp;
}
}
@jakeboxer
jakeboxer / gist:3605769
Created September 3, 2012 00:07
FizzBuzz Test
Write a program that prints the numbers from 1 to 100. But for multiples of
three print “Fizz” instead of the number and for the multiples of five print
“Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.
So, for example, if you were to print from 1 to 20, it would look like this:
1
2
Fizz
4
@jakeboxer
jakeboxer / gist:3941060
Created October 23, 2012 19:35
Naive string reverse implementation
function reverseString(oldString) {
var newString = "";
for (var i = oldString.length - 1; i >= 0; i--) {
// This line does exactly the same thing as: newString = newString + oldString[i];
newString += oldString[i];
}
return newString;
}
r = Repository.nwo('defunkt/dotjs')
u = User.find_by_login('defunkt')
30.times do
i = r.issues.build
i.user = u
i.title = 'Placeholder issue'
i.body = 'This is the body for the placeholder issue'
i.save
end
@jakeboxer
jakeboxer / gist:4037794
Created November 8, 2012 09:40
Factorial in C
int factorial(int number) {
if (number == 1) {
return 1;
} else {
return number * factorial(number - 1);
}
}
def read_full_blob(oid)
object = send_message(:read_full_blob, oid)
object['data'].force_encoding(object['encoding']) if encoding_support?
object
end
send_message(:read_objects, miss_oids, type).each do |object|
key = object_key(object['oid'])
objects[key] = object
@cache.set(key, object)
end