Skip to content

Instantly share code, notes, and snippets.

View rtsinani's full-sized avatar
🏠
Working from home

Artan Sinani rtsinani

🏠
Working from home
View GitHub Profile
@rtsinani
rtsinani / pre-commit
Last active October 18, 2017 15:05
Run rubocop on `git commit` (add to the `/.git/hooks` folder of your app)
#!/bin/sh
#
# Check for ruby style errors
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
NC='\033[0m'
if git rev-parse --verify HEAD >/dev/null 2>&1
@rtsinani
rtsinani / rbenv-howto.md
Created November 3, 2015 12:34 — forked from MicahElliott/rbenv-howto.md
Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

This guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.

TL;DR Demo

# Ensure system is in ship-shape.

aptitude install git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev

@rtsinani
rtsinani / cache.rake
Last active December 19, 2015 03:29
Rails 3.2 ceate static pages with page_cache and rake
desc 'Generate the static pages'
task :cache => :environment do
pages = %w(404 422 500)
app = Rails.application
app.config.action_controller.perform_caching = true
session = ActionDispatch::Integration::Session.new(app)
pages.each { |page| puts session.get("/#{page}") }
end
window.addEventListener "DOMContentLoaded", ->
body = $ "body"
canvas = $ "#canvas"
chalkboard = $ "#chalkboard"
close = $ "#close"
ledge = $ "#ledge"
lightswitch = $ "#lightswitch"
output = $ "#output"
shade = $ "#shade"
share = $ "#share"