Skip to content

Instantly share code, notes, and snippets.

View willnet's full-sized avatar
👶
parenting

Shinichi Maeshima willnet

👶
parenting
View GitHub Profile
@hiroy
hiroy / gist:75b83d055563e3008909
Last active August 29, 2015 14:05
ゆるデ部室

ゆるデ部室

第1回meetupによせて

初めましての方もそうでない方もこんばんは。

合同会社qumuあらため合同会社テンマド(10mado, LLC)の山岡(@hiro_y)です。

この中にフリーランスの方、どれぐらいいらっしゃるでしょうか。 また、例えば就業後とか週末とか、自宅じゃない作業場所がほしい人は?

@tompng
tompng / n1_safe.rb
Last active August 29, 2015 14:18
railsでn+1クエリとか考えたくないし全自動でどうにかしてほしい https://github.com/tompng/n1_safe に移動
##controller
def index
#includesとかはせずにとりあえずn1_safeを付けておく
@posts = Post.all.n1_safe
end
#Post load (X.Xms) SELECT "posts".* FROM "posts"
##view
#なにも考えずにeachとかまわしまくると、必要になった時にまとめてN+1を回避しつつloadされる感じ
<% @posts.each do |post| %>
@ches
ches / .pryrc
Created August 29, 2011 06:39
Enable Hirb in Pry, and hack disable/enable to work in-session
begin
require 'hirb'
rescue LoadError
# Missing goodies, bummer
end
if defined? Hirb
# Dirty hack to support in-session Hirb.disable/enable
Hirb::View.instance_eval do
def enable_output_method
@sharl
sharl / emacs.rb
Created February 24, 2012 08:29
Yet Another Emacs 23.4 homebrew Formula (ATOK support? unconfirmed)
require 'formula'
class Emacs < Formula
url 'http://ftp.gnu.org/pub/gnu/emacs/emacs-23.4.tar.bz2'
md5 '070c68ad8e3c31fb3cb2414feaf5e6f0'
homepage 'http://www.gnu.org/software/emacs/'
if ARGV.include? "--use-git-head"
head 'git://git.sv.gnu.org/emacs.git'
else
@jachenry
jachenry / template_handler.rb
Created October 11, 2012 04:06
SCSS Template Handler
require 'sass/plugin'
module Sass
module Rails
class TemplateHandler
class_attribute :default_format
self.default_format = Mime::CSS
def initialize
end
@jugyo
jugyo / to_factory_girl.rb
Created November 7, 2012 05:54
ActiveRecord extension to print FactoryGirl definition!
class ActiveRecord::Base
# Usage:
#
# > puts User.first.to_factory_girl
# FactoryGirl.define do
# factory :user do
# ...
# end
# end
# # Usage: FactoryGirl.create(:user, ...)
@akiyan
akiyan / transcribed-the-miyagawas-podcast-ep1.md
Last active December 14, 2015 01:59
Tatsuhiko Miyagawa's Podcast ep1 の文字起こしです。 http://podcast.bulknews.net/post/42992556069/podcast-ep1

最近ブログ書いてますよね #00:00:00.0#

miyagawa naoyaさん、最近は結構ブログが活発になってきている感じですね。
naoya はいはい、そうですよね。
miyagawa なんか、心境の変化があったんですか。
naoya 心境の変化(笑)
miyagawa (笑)
naoya いやずっとドラクエしかしてなかったんですけど(笑)

#383 - July 2, 2013

Olivier Lacan, Tony Winn

One Liner Webserver (0:30-)

Nobuyoshi Nakada showed a beautifully simple way to start a web server within the present working directory by only using Ruby. ruby -run -e httpd . -p 5000

  • I know this is the(?) exchange between Aaron Patterson and Nobuyoshi Nakada, both Ruby core contirbutors yesterday on Twitter, Nobuyoshi showed beautifully simple way to start a web server within the present working directory by only using ruby.
  • You mean something like that single-line Python script that was floating(?) around?
  • Yeah, exactly. All you need to do is call ruby -run -e httpd . -p 5000. That will start the server using WEBrick, which comes with(?) the Ruby Standard Library, and you can see the server running at localhost:5000 in your brouser(?), if you have an index.html file in that directory, it will show up in your browser.
url:
'https://username:password@github.com/username/foo-bar-baz.git'
@slightair
slightair / gazoreply.user.js
Created December 4, 2013 05:57
replace gazoreply.jp copy image url
// ==UserScript==
// @name http://gazoreply.jp/
// @description replace gazoreply.jp copy image url
// @include http://gazoreply.jp/*
// @exclude http://gazoreply.jp/situation/*
// ==/UserScript==
window.addEventListener('load', function(){
var imgURL = document.getElementById("main-photo-img").getAttribute('src');
var clipboardButtonElement = document.getElementById("copy-clipboard-btn");