Skip to content

Instantly share code, notes, and snippets.

@Epictetus
Epictetus / buildenv.bash
Created May 30, 2012 19:15 — forked from mizchi/buildenv.bash
rails and node
#!/bin/bash
sudo apt-get update
# = utils
sudo apt-get -y install ssh curl git
# = rvm requirements
sudo apt-get -y install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
@Epictetus
Epictetus / wordpress-heroku-ja-install.sh
Created May 30, 2012 11:48 — forked from masainox/wordpress-heroku-ja-install.sh
日本語環境のwordpressをherokuにセットアップするスクリプト
#!/bin/sh
git clone git://github.com/masainox/wordpress-heroku.git -b language-ja
cd wordpress-heroku
heroku create --stack cedar
heroku addons:add shared-database:5mb
# create a new branch
git checkout -b production
@Epictetus
Epictetus / app.js
Created May 24, 2012 13:22 — forked from hokaccha/app.js
express mapRouter
var express = require('express')
, mapRouter = require('./express-mapRouter')
, app = express.createServer()
, routesDir = __dirname + '/routes';
// 'GET /' : 'root:index' はこれと同じ
// var root = require('./routes/root');
// app.get('/', root.index);
var routesMap = {
'GET /' : 'root:index'
@Epictetus
Epictetus / will_paginate.rb
Created May 23, 2012 01:39 — forked from henrik/will_paginate.rb
Extends will_paginate to play well with Twitter's Bootstrap (http://twitter.github.com/bootstrap/). Suggested location: config/initializers/will_paginate.rb
# https://gist.github.com/1214011
module WillPaginate
module ActionView
def will_paginate(collection = nil, options = {})
options[:renderer] ||= BootstrapLinkRenderer
super.try :html_safe
end
class BootstrapLinkRenderer < LinkRenderer
@Epictetus
Epictetus / application_helper.rb
Created May 23, 2012 01:00
Link renderer and helper method to be used with will_paginate to render links to work with Twitter Bootstrap
module ApplicationHelper
def paginate *params
params[1] = {} if params[1].nil?
params[1][:renderer] = BootstrapPaginationHelper::LinkRenderer
will_paginate *params
end
end
@Epictetus
Epictetus / will_paginate.rb
Created May 18, 2012 22:06 — forked from cornerwings/will_paginate.rb
extends will_paginate to play well with Twitter's Bootstrap
# config/initializers/will_paginate.rb
# tested with will_paginate 2.3 stable
module WillPaginate
class BootstrapLinkRenderer < LinkRenderer
def to_html
links = @options[:page_links] ? windowed_links : []
# previous/next buttons
links.unshift page_link_or_span(@collection.previous_page, 'disabled prev', "&larr; Previous")
links.push page_link_or_span(@collection.next_page, 'disabled next', "Next &rarr;")
@Epictetus
Epictetus / will_paginate.rb
Created May 18, 2012 22:03 — forked from isaacbowen/will_paginate.rb
extends will_paginate to play well with Twitter's Bootstrap
# config/initializers/will_paginate.rb
module WillPaginate
module ActionView
def will_paginate(collection = nil, options = {})
options[:renderer] ||= BootstrapLinkRenderer
super.try :html_safe
end
class BootstrapLinkRenderer < LinkRenderer
@Epictetus
Epictetus / application_helper.rb
Created May 18, 2012 21:56 — forked from purcell/application_helper.rb
Make will_paginate generate HTML that bootstrap.less will render nicely
# Based on https://gist.github.com/1182136
class BootstrapLinkRenderer < ::WillPaginate::ActionView::LinkRenderer
protected
def html_container(html)
tag :div, tag(:ul, html), container_attributes
end
def page_number(page)
tag :li, link(page, page, :rel => rel_value(page)), :class => ('active' if page == current_page)
@Epictetus
Epictetus / hoge.wiki
Created May 13, 2012 12:45
VirturalboxにCentOS6.2で開発環境構築 with Mosh

vm

  • CentOS6.2
  • HDD=10 GB
  • MEM=768 MB
  • 192.168.56.11

必須

  • gcc, gcc-c++
  • make
  • unzip
@Epictetus
Epictetus / gist:2670018
Created May 13, 2012 01:02 — forked from markpundsack/gist:2492606
Heroku Status API v3

Heroku Status API v3 (second draft)

Get current status

$ curl "https://status-beta.heroku.com/api/v3/current-status"
{"status":{"Production":"green","Development":"green"},"issues":[]}

Get list of issues (optionally limited by date or count)