Skip to content

Instantly share code, notes, and snippets.

View yasu's full-sized avatar

Yasuhiro Manai yasu

View GitHub Profile
@yasu
yasu / install-mysql5.7-circleci.sh
Created March 21, 2017 17:55
Install MySQL 5.7 non-interactively in CircleCI
#!/bin/bash
set -x
set -e
export DEBIAN_FRONTEND=noninteractive
curl -LO https://dev.mysql.com/get/mysql-apt-config_0.8.3-1_all.deb
echo mysql-apt-config mysql-apt-config/select-product select Apply | sudo debconf-set-selections
echo mysql-apt-config mysql-apt-config/select-server select mysql-5.7 | sudo debconf-set-selections
echo mysql-apt-config mysql-apt-config/select-connector-python select none | sudo debconf-set-selections
@yasu
yasu / gist:6399280
Created August 31, 2013 16:31
Steps of Backbone.js
1. Namespace
2. Backbone.history.start()
3. Routers -> Views <- Collections (Model)
<- Templates
=> .html() to Render
@yasu
yasu / gist:6383276
Last active December 21, 2015 23:38
Switching from Restful Authentication to Devise while upgrading Rails 2.3 to Rails 3.
# /config/initializers/devise_encryptor.rb
require "digest/sha1"
REST_AUTH_SITE_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
REST_AUTH_DIGEST_STRETCHES = 10
module Devise
module Encryptable
module Encryptors
module ModelClassMethods
@yasu
yasu / gist:5680693
Created May 30, 2013 20:03
_why's saying
when you don’t create things, you become defined by your tastes rather than ability. your tastes only narrow & exclude people. so create. – Why the lucky stiff
(何も作っていないとき、人は自分の能力よりも好みによって特徴付けられることになる。好みは世界は狭め、他人を排除するばかりだ。だから、作れ)
http://el.jibun.atmarkit.co.jp/rails/2012/04/_why-c06c.html
http://www.youtube.com/watch?v=Urw98i42HsI
@yasu
yasu / gist:5088031
Last active December 14, 2015 12:38
using coffee instead of codekit
$ coffee -w -cj ../mvc.community.js *.coffee
$ coffee -w -o ../ -c mvc.community.invites.coffee
@yasu
yasu / gist:2882046
Created June 6, 2012 14:03
ライブ ストリーミング中
<span class="channel-horizontal-menu-badge">ライブ ストリーミング中</span>
.channel-horizontal-menu li a span.channel-horizontal-menu-badge {
background-color:
#9A302C;
color:
white;
font-size: 8px;
font-weight: bold;
padding: 3px 5px;
@yasu
yasu / gist:1647841
Created January 20, 2012 15:16
How apply() and call() work
function makeArray(arg1, arg2){
return [ this, arg1, arg2 ];
}
var gasGuzzler = { year: 2008, model: 'Dodge Bailout' };
makeArray.apply( gasGuzzler, [ 'one', 'two' ] );
// => [ gasGuzzler, 'one' , 'two' ]
makeArray.call( gasGuzzler, 'one', 'two' );
// => [ gasGuzzler, 'one' , 'two' ]
// Make a function that assigns event handler functions to an array of nodes the right way.
// When you click on a node, an alert box will display the ordinal of the node.
var add_the_handlers = function (nodes) {
var i;
for (i = 0; i < nodes.length; i += 1) {
nodes[i].onclick = function (i) {
return function (e) {
alert(i);
};