Skip to content

Instantly share code, notes, and snippets.

@koncha99
koncha99 / gulpfile.js
Created April 24, 2016 02:33 — forked from danharper/gulpfile.js
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
@koncha99
koncha99 / 0. nginx_setup.sh
Created March 19, 2016 06:16 — forked from mikhailov/0. nginx_setup.sh
NGINX+SPDY with Unicorn. True Zero-Downtime unless migrations. Best practices.
# Nginx+Unicorn best-practices congifuration guide. Heartbleed fixed.
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#
@koncha99
koncha99 / unicorn.rake
Created February 2, 2016 14:47
rake task for unicorn
namespace :unicorn do
##
# Tasks
##
desc "Start unicorn for development env."
task(:start) {
config = Rails.root.join('config', 'unicorn.rb')
sh "bundle exec unicorn_rails -c #{config} -E development -D"
}
@koncha99
koncha99 / reciprocal.rb
Created November 4, 2015 12:20
CSV逆関数化
def reciprocal(path)
#csvの読み込み
require 'csv'
table = CSV.read(path)
f = File.open('output.txt','a')
total = [] #各センサーデータの合計値を格納
table[0][0] = "機種名"
for i in 0...table[0].length
@koncha99
koncha99 / PageNator.rb
Last active November 4, 2015 12:19
ページネーター
class PageNator
#データの読み込み(1行づつ読み込み、配列へ格納)
def initialize(path, posi)
data = []
f = File.open(path, 'r')
f.each do |line|
data.push(line)
end
f.close