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
View app.js
var express = require('express')
, app = express()
, http = require('http')
, server = http.createServer(app)
, io = require('socket.io').listen(server);
server.listen(4000);
app.get('/', function(request, response){
response.sendfile(__dirname + "/index.html");
@shime
shime / .gitignore
Last active Dec 24, 2015 — forked from uu59/.gitignore
socket.io and sinatra in action
View .gitignore
vendor/
.bundle/
node_modules/
Gemfile.lock
@shime
shime / readme.md
Last active Nov 16, 2017
bake your own code reloader for rails
View readme.md

Let's build our own code reloader for Rails, shall we?

Require dependency problems

Run this inside rails/railties:

$ grep -rn "eager_load_paths" .

You should get the results from Rails::Engine::Configuration and Rails::Engine. As you know, each Rails application is actually a Rails::Engine and Rails::Engine::Configuration is that thing wrapped inside Rails.application.config block.

@shime
shime / _app.rb
Last active Dec 23, 2015
DCI implementation of OAuth with Github in Sinatra
View _app.rb
require "sinatra"
get "/oauth/github" do
OAuthingWithGithub.start(self)
end
get "/oauth/github/callback" do
OAuthingWithGithub.finish(self)
end
@shime
shime / readme.md
Created Sep 15, 2013
order of stubs and factory girl
View readme.md
  1. stub
  2. Model.new
  3. FactoryGirl.build_stubbed
  4. FactoryGirl.create

Always choose the upper one if you can.

@shime
shime / readme.md
Created Sep 10, 2013
stop clearing screen when suspending from vim
View readme.md

I've been watching a lot of Gary Bernhardt's videos lately. I like how he constantly switches from Vim to terminal simply by using <C-z> to suspend Vim and $ fg to bring it back to the foreground.

The behavior of my local Vim was quite different, though. My screen was cleared every time I exit Vim. It was annoying. It was painful. I've finally stumbled upon solution:

" place this in your ~/.vimrc

set t_ti= t_te=
@shime
shime / readme.md
Created Sep 2, 2013
bash keyboard shortcuts
View readme.md

Bash keyboard shortcuts

Characters

  • move back one character: Ctrl + b
  • move forward one character: Ctrl + f
  • delete current character: Ctrl + d
  • delete previous character: backspace
@shime
shime / _readme.md
Last active Oct 24, 2016
describes redirection issue from stackoverflow.com/a/9627796/726020
View _readme.md

Run it with:

curl -fsSL https://gist.github.com/shime/6129865/raw/try_it.sh | bash -e
@shime
shime / _README.md
Last active Dec 19, 2015
replicate a Gemrat issue described by @dru in https://github.com/DruRly/gemrat/pull/13
View _README.md

Run it with:

$ curl -fsSL https://gist.github.com/shime/5922687/raw/issue | bash -e
@shime
shime / _README.md
Last active Oct 2, 2019
getting tired of guessing tar flags in 2013?
View _README.md

Looks familiar?

Worry no more! Use extract and prosper!

Usage

You can’t perform that action at this time.