Skip to content

Instantly share code, notes, and snippets.

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 December 24, 2015 17:39 — forked from uu59/.gitignore
socket.io and sinatra in action
vendor/
.bundle/
node_modules/
Gemfile.lock
@shime
shime / readme.md
Last active March 13, 2020 09:39
bake your own code reloader for rails

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 December 23, 2015 20:39
DCI implementation of OAuth with Github in Sinatra
require "sinatra"
get "/oauth/github" do
OAuthingWithGithub.start(self)
end
get "/oauth/github/callback" do
OAuthingWithGithub.finish(self)
end
@shime
shime / readme.md
Created September 15, 2013 09:37
order of stubs and factory girl
  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 September 10, 2013 21:13
stop clearing screen when suspending from vim

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 September 2, 2013 07:24
bash keyboard shortcuts

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 October 24, 2016 04:42
describes redirection issue from stackoverflow.com/a/9627796/726020
@shime
shime / _README.md
Last active December 19, 2015 07:59
replicate a Gemrat issue described by @dru in https://github.com/DruRly/gemrat/pull/13
@shime
shime / _README.md
Last active April 2, 2024 17:00
getting tired of guessing tar flags in 2013?

Looks familiar?

Worry no more! Use extract and prosper!

Usage