Skip to content

Instantly share code, notes, and snippets.

View shuhei's full-sized avatar
🐢
...

Shuhei Kagawa shuhei

🐢
...
View GitHub Profile
@shuhei
shuhei / projections.json
Created May 7, 2014 07:56
A projection setting file for vim-rails.
{
"app/services/*.rb": {
"command": "service"
},
"app/workers/*.rb": {
"command": "worker"
},
"app/assets/javascripts/models/*.js.coffee": {
"command": "jmodel"
},
nkf -w --overwrite b_20140301.txt
grep "心筋梗塞" b_20140301.txt | cut -d "," -f 3,6 | sed -e 's/"//g' | sed -e 's/,/ /g' | less
var path = require('path');
var util = require('util');
var through = require('through2');
module.exports = function (filename) {
var contents = [];
var cwd = process.cwd();
var base = cwd;
function transform(file, encoding, cb) {
@media only screen and (max-width: 767px) {
/* Do whatever. */
}
var gulp = require('gulp');
var concat = require('gulp-concat');
var prefixer = require('gulp-autoprefixer');
var minify = require('gulp-minify-css');
var imagemin = require('gulp-imagemin');
var plumber = require('gulp-plumber');
gulp.task('css', function () {
gulp.src('htdocs/css/**/*.css')
.pipe(plumber())
@shuhei
shuhei / api_spec.rb
Last active January 3, 2016 13:09
Idea for Rails with swagger spec. Pass more information as a parameter to api method.
module ApiSpec
attr_reader :apis
def api
@is_api = true
end
def method_added(id)
return unless @is_api
@apis ||= []
@shuhei
shuhei / .gitignore
Last active April 25, 2023 09:05
An example `gulpfile.js` for CoffeeScript and Browserify. Note that this uses gulp-browserify's master. Update this as soon as 0.2.6 is out.
/node_modules
/build
namespace Foo.Bar
{
using System;
public static class MonadicNullable
{
public static TResult Match<T, TResult>(this T? nullable, Func<T, TResult> projection, Func<TResult> nullFunc)
where T : struct
{
return nullable.HasValue ? projection(nullable.Value) : nullFunc();
@shuhei
shuhei / setupGOROOT.sh
Created December 5, 2013 13:07 — forked from ivanzoid/setupGOROOT.sh
As of go 1.2
#
# Place this code to your .profile, .bashrc, .bash_profile or whatever
#
program_exists () {
type "$1" &> /dev/null ;
}
if program_exists go; then
@shuhei
shuhei / web_crawler.go
Created November 13, 2013 16:49
(A Tour of Go #71) Exercise: Web Crawler http://tour.golang.org/#71
package main
import (
"fmt"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.
Fetch(url string) (body string, urls []string, err error)