Skip to content

Instantly share code, notes, and snippets.

Hrvoje Šimić shime

Block or report user

Report or block shime

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
shime /
Last active Jan 9, 2020
github oauth in node using express


Most basic example of authenticating with Github in node.


Clone this gist, change keys inside config.js and then hit npm install && node app.js.


shime /
Last active Nov 5, 2019
getting tired of guessing tar flags in 2013?

Looks familiar?

Worry no more! Use extract and prosper!


shime /
Last active Sep 29, 2019
The Qlobe - by Yusuke Endoh


Qlobe is a fascinating example of quine in Ruby, submitted by a member of the Ruby core team - Yusuke Endoh.

Programs that output changed executable versions of themselves while managing to spin the globe and still remaining executable are cool, right?

To experience its magic, run the following

curl -fSSl > qlobe.rb; while true; do ruby qlobe.rb | tee temp.rb; sleep 1; mv -f temp.rb qlobe.rb; done
shime /
Last active Aug 15, 2019 — forked from ryin/
installation script for tmux 1.9a

Having trouble installing the latest stable version of tmux?

I know, official package for your OS/distro is outdated and you just want the newest version of tmux.

Well, this script should save you some time with that.


  • gcc
shime / rc.xml
Created Nov 6, 2014
openbox shortcuts for window management
View rc.xml
<!-- resize windows with Alt + Direction -->
<keybind key="A-Right">
<action name="GrowToEdgeEast"/>
<keybind key="A-Left">
<action name="GrowToEdgeWest"/>
<keybind key="A-Down">
<action name="GrowToEdgeSouth"/>
shime /
Last active May 3, 2019
Secret Github Features

Taken from Zach Holman's "Git and Github Secrets".

Keyboard Shortcuts

t - quickly jump through files (similar to cmd+T in VI or Text Mate)

w - quickly switch branches

s - search

shime /
Last active Apr 22, 2019
comparing dates and times in RSpec

What is this?

How do you compare date/times in RSpec?

If you do this

expect( eq, 4, 2).to_i
shime / reseed.rake
Last active Dec 18, 2018
Reseed database in Rails without dropping it. Originally posted at
View reseed.rake
namespace :db do
desc 'Clears the database and then seeds it'
task reseed: :environment do
desc 'Clears the database'
task truncate: :environment do
puts "Truncating database"
shime / list_files.js
Created Oct 9, 2014
list files in a directory with node.js
View list_files.js
var fs = require('fs'),
path = require('path')
var listFiles = function(dir, next){
fs.readdir(dir, function(err, nodes){
if (err) next(err)
next(null, nodes.filter(function(node){
return fs.lstatSync(path.resolve(dir) + "/" + node).isFile()
shime / tracking.rb
Created Dec 21, 2012
Tracking request durations in Rails. Courtesy of @stathat
View tracking.rb
if Rails.env.production?
slow_logfile ="log", "slow.log"), 'a')
slow_log =
slow_log.level = Logger::INFO
ActiveSupport::Notifications.subscribe "process_action.action_controller" do |name, start, finish, id, payload|
duration = (finish - start) * 1000
StatHat::API.ez_post_value("rails request duration", "", duration)
view_time = 0
db_time = 0
You can’t perform that action at this time.