Skip to content

Instantly share code, notes, and snippets.

View tkfm-yamaguchi's full-sized avatar

Takafumi Yamaguchi tkfm-yamaguchi

View GitHub Profile
@jrochkind
jrochkind / asset_precompile_prefix_fix.rb
Created January 11, 2012 16:15
Rails 3.1.3 asset precompile with SubURI fix
# ./config/initializers/asset_precompile_prefix_fix.rb
#
# So we can deploy at a SubURI, and precompile assets to respect that with:
# RAILS_RELATIVE_URL_ROOT=/foo rake assets:precompile
#
# See: http://stackoverflow.com/questions/7293918/broken-precompiled-assets-in-rails-3-1-when-deploying-to-a-sub-uri
#
# Confirmed working in Rails 3.1.3
# Future versions of Rails may make this monkey patch unneccesary. (or break
# it without making it unneccesary)
@Phize
Phize / .vimrc_local
Created February 2, 2012 09:05
Vim: switching github accounts for Gist.vim
" **************************************************
" Gist {{{
" **************************************************
" dictionary of Gist accounts.
let g:gist_accounts = {
\ 'user1': {
\ 'password': 'password'
\ },
\ 'user2': {
\ 'password': 'password'
@navilan
navilan / fuctions.py
Created February 6, 2012 15:59
A hyde plugin to add a context function to jinja and related
#<site_root>/functions.py
from hyde.plugin import Plugin
def quoted(var):
return '"%s"' % var
class MyJinjaLoader(Plugin):
def template_loaded(self, template):
@barryvdh
barryvdh / Example html
Created June 6, 2012 13:11
Sticky Footer (Less)
<div class="wrapper">
<div class="container">
<header>
</header>
<div id="content">
</div>
</div>
<div class="footer-push"></div>
@mattn
mattn / dash.vim
Last active December 13, 2015 21:09
function! s:dash(...)
let word = len(a:000) == 0 ? input('Dash search: ') : a:1
call system(printf("open dash://'%s'", word))
endfunction
command! -nargs=? Dash call <SID>dash(<f-args>)
@yasushiyy
yasushiyy / vagrant_coreos_docker.md
Last active January 28, 2019 11:35
Vagrant + CoreOS + Dockerを利用した開発環境セットアップ

Vagrant + CoreOS + Dockerを利用した開発環境セットアップ

MacOSX + Vagrant + CoreOS + Docker + Ubuntuの環境。

2014年6月11日時点での情報。

  • Version: CoreOS 343.0.0
  • Kernel: 3.14.5
  • Docker: 1.0
@tmatilai
tmatilai / Vagrantfile
Last active January 1, 2021 19:49
My global Vagrant configuration (~/.vagrant.d/Vagrantfile)
# URI of the local (caching) HTTP proxy
LOCAL_HTTP_PROXY = 'http://192.168.33.200:8123'
# Configures vagrant-cachier and vagrant-proxyconf.
# Should be called only on "local machine" providers.
def configure_caching(config)
if Vagrant.has_plugin?('vagrant-cachier')
config.cache.enable_nfs = true
config.cache.enable :gem
config.cache.enable :npm
@ser1zw
ser1zw / _tmuxinator
Created March 29, 2012 19:43
zsh completion for tmuxinator
#compdef tmuxinator mux
# zsh completion for tmuxinator
# Install:
# $ mkdir -p ~/.tmuxinator/completion
# $ cp _tmuxinator ~/.tmuxinator/completion
# $ vi ~/.zshrc # add the following codes
# fpath=($HOME/.tmuxinator/completion ${fpath})
# autoload -U compinit
@Kobold
Kobold / write_restricted_model_serializer.py
Created February 26, 2014 20:34
A default read-only serializer for django-rest-framework as of DRF 2.4.
class RestrictedSerializerOptions(serializers.ModelSerializerOptions):
"""
Meta class options for ModelSerializer
"""
def __init__(self, meta):
super(RestrictedSerializerOptions, self).__init__(meta)
self.writable_fields = getattr(meta, 'writable_fields', ())
class WriteRestrictedModelSerializer(serializers.ModelSerializer):
@FiloSottile
FiloSottile / HEAD-request.py
Created March 18, 2012 16:43
How to send a HEAD HTTP request in Python with urllib2
import urllib2
class HeadRequest(urllib2.Request):
def get_method(self):
return "HEAD"
class HEADRedirectHandler(urllib2.HTTPRedirectHandler):
"""
Subclass the HTTPRedirectHandler to make it use our
HeadRequest also on the redirected URL