Skip to content

Instantly share code, notes, and snippets.

View rottmanj's full-sized avatar

Jeremy Rottman rottmanj

  • Amazon
  • Seattle, WA
View GitHub Profile
Building native extensions. This could take a while...
Building nokogiri using packaged libraries.
Building libxml2-2.8.0 for nokogiri with the following patches applied:
- 0001-Fix-parser-local-buffers-size-problems.patch
- 0002-Fix-entities-local-buffers-size-problems.patch
- 0003-Fix-an-error-in-previous-commit.patch
- 0004-Fix-potential-out-of-bound-access.patch
- 0005-Detect-excessive-entities-expansion-upon-replacement.patch
- 0006-Do-not-fetch-external-parsed-entities.patch
- 0007-Enforce-XML_PARSER_EOF-state-handling-through-the-pa.patch
$(function(){
$('#masonry-container').masonry({
itemSelector: '.box',
columnWidth: 200,
isAnimated: !Modernizr.csstransitions,
isFitWidth: true
});
});
total_records = 135
offset = 0
item_per_page
page = 2
offset = (page - 1) * item_per_page
while offset < total_records do
# do something
@rottmanj
rottmanj / gist:8481633
Last active January 3, 2016 15:19
Association suggestions for Bharat
In the file
https://github.com/bayyar/wikiful/blob/master/app/views/categories/show.html.erb#L8-L14
Change it to this:
<% @category.articles.each do |article| %>
<tr>
<td><%= link_to article.title.truncate(25), article %></td>
<td><%= article.created_at.strftime('%b %d, %Y') %></td>
<td><%= truncate(article.content, length:100) %></td>
@rottmanj
rottmanj / gist:8407632
Created January 13, 2014 20:36
Mac OSX Stuff
Alfred
oh-my-zsh
Bartender
Sizeup
iTerm2
VLC
The Unarchiver
Skitch
F.lux
HyperDock
@rottmanj
rottmanj / gist:8320908
Created January 8, 2014 17:38
Custom Bira zsh theme
# ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
# COLOR SETTINGS
BIRA_BRACKET_COLOR="%{$fg[white]%}"
BIRA_TIME_COLOR="%{$fg[yellow]%}"
BIRA_RVM_COLOR="%{$fg[magenta]%}"
BIRA_DIR_COLOR="%{$fg[cyan]%}"
BIRA_GIT_BRANCH_COLOR="%{$fg[green]%}"
@rottmanj
rottmanj / linked_list.rb
Created January 2, 2014 20:46
Ruby Linked List Implementation
class Node
attr_accessor :node, :next
def self.last(node)
return node if node.next.nil?
node = last node.next
end
def self.reverse(node)
return node if node.next.nil?
@rottmanj
rottmanj / gist:8044559
Created December 19, 2013 19:14
Create a user in postgres
sudo su postgres -c 'createuser -P --superuser madelek13'
@rottmanj
rottmanj / gist:8014603
Created December 17, 2013 23:23
letsrevolutionizetesting.com challenge script
require 'open-uri'
require 'JSON'
url = "http://www.letsrevolutionizetesting.com/challenge"
i_am_the_winner = false
until i_am_the_winner do
json = JSON.parse(open(url, "Accept" => "application/json").read)
if json.has_key?("follow")
url = json["follow"]
@rottmanj
rottmanj / apiary.rake
Created November 25, 2013 00:03
Apiary rake task. Combines all .apib files into a single file so that it can be consumed by apiary.
namespace :docs do
namespace :apiary do
task :build do
File.delete("#{Rails.root}/docs/apiary/blueprint.apib") if File.exist?("#{Rails.root}/docs/apiary/blueprint.apib")
header = File.open("#{Rails.root}/docs/apiary/header.apib")
File.open("#{Rails.root}/docs/apiary/blueprint.apib", 'a') do |file|
file.write(header.read)
header.close