Skip to content

Instantly share code, notes, and snippets.

View pokka's full-sized avatar
🌮
I may be slow to respond.

Pokka pokka

🌮
I may be slow to respond.
View GitHub Profile
@pokka
pokka / nginx.conf
Created November 28, 2012 06:28
nginx404_for_pictures,base
server {
listen 3000;
server_name host;
root /path/to/project/..;
#passenger_enabled on;
#rails_env development;
location ~* \.(js|css|gif|png|bmp|jpeg|jpg|swf)$ {
access_log off;
log_not_found off;
@pokka
pokka / gist:4213206
Created December 5, 2012 07:00
requiring files with recursive
Dir[File.expand_path(File.join(File.dirname(__FILE__),dir,'**','*.rb'))].each {|f| require f}
@pokka
pokka / tab-cs-guake.sh
Last active December 14, 2015 15:08
Terminal working with tabs
#!/bin/bash
usr_path=/your/home/dir/
ws_path=$usr_path'your/workspace/dir'
project=$ws_path'your/project/dir'
guake -e "cd '$ws_path';pwd"
guake -r workspace
guake -n 1
guake -r cs
@pokka
pokka / delay.es6.js
Last active September 6, 2016 06:15
simple delay javascript function,when you care about duplicate execute
let timer;
const delay = (func, ms = 500) => {
clearTimeout(timer);
timer = setTimeout(func, ms);
}
export default delay;
namespace :deploy do
task :setup_solr_data_dir do
run "mkdir -p #{shared_path}/solr/data"
end
end
namespace :solr do
desc "start solr"
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && RAILS_ENV=#{rails_env} bundle exec sunspot-solr start --port=8983 --data-directory=#{shared_path}/solr/data --pid-dir=#{shared_path}/pids"
@pokka
pokka / Guthrie IP.md
Created September 12, 2013 10:35 — forked from holman/Guthrie IP.md

This song is Copyrighted in U.S., under Seal of Copyright # 154085, for a period of 28 years, and anybody caught singin it without our permission, will be mighty good friends of ourn, cause we don’t give a dern. Publish it. Write it. Sing it. Swing to it. Yodel it. We wrote it, that’s all we wanted to do.

  • Woody Guthrie, 1940's —
@pokka
pokka / cake.rb
Created January 28, 2014 07:59
Run rake task in console
require 'rake'
#cake == console rake
module Cake
attr :trace
attr :alias_tasks
attr :current_task
@alias_tasks = {}
@trace = false
@pokka
pokka / count_rb_files
Created February 9, 2015 04:47
Count ruby files in your project
find . -iname "*.rb" -type f -exec cat {} \; | wc -l
@pokka
pokka / output_to_file_or_nothing
Last active August 29, 2015 14:15
Run linux cmd with a target output and run in background
cmd > log 2>&1 &
#Redirects STDOUT to log and than replaces STDERR with the redirected STDOUT.
cmd 2>&1 > log &
#Replaces STDERR with STDOUT and then redirects the original STDOUT to log.
cmd 2>&1 > /dev/null &
@pokka
pokka / gist:74aa3d4451f1df793693
Last active August 29, 2015 14:20
Check the ports stat in linux
netstat -an | grep -i listen
netstat -an | grep -i listen | grep PORTNUMBERYOUWANT