Skip to content

Instantly share code, notes, and snippets.

View dot's full-sized avatar
😇

Shuhei KONDO dot

😇
View GitHub Profile
@dot
dot / gist:8347592
Last active October 7, 2016 10:06
github release note geneartor
javascript:(function() {
alert(Array.from(document.querySelectorAll('.commit-message .issue-link')).map(
function(i) {
var _i = i.closest('.commit-message');
if (_i.textContent.trim().match(/^Merge pull request/)) {
return {num: i.textContent, title: _i.querySelector('.commit-desc').textContent};
}
}).filter(data => data !== undefined).sort(function(a, b) { return a.num >= b.num ? 1: -1}).map(function(i) {
return "* " + i.num + " " + i.title.replace(/\[\#(\d+)\]/g, "([$1](https://www.pivotaltracker.com/story/show/$1))");
}).join("\n"));
@dot
dot / skip_migration.rb
Created January 21, 2014 02:58
skipping mongoid migration
migrations = Mongoid::Migrator.new(:up, 'db/migrate', nil).migrations.map(&:version)
target = migrations.last
start = 0
finish = migrations.index(target)
migrations[start..finish].each do |m|
DataMigration.create(version: m) unless DataMigration.where(version: m.to_s).exists?
end
@dot
dot / config
Created January 21, 2014 07:43
svn configuration
[miscellany]
enable-auto-props = yes
[auto-props]
* = svn:needs-lock=true
@dot
dot / deploy_staging.js
Last active August 29, 2015 13:57
staging deploy bookmarklet
javascript:(function(){ alert('bundle exec mina deploy to=staging branch='+$('.merge-pr-more-commits code a').text()) })();
@dot
dot / mongohq.md
Last active August 29, 2015 13:57
mongohq diff of small and ssd_1g_elastic plan

performance check

find 10 ids

Benchmark.measure {100.times {CompletedSheet.find(ids)}}

| no| small | ssd_1g_elastic |

@dot
dot / sequencer.js
Last active August 29, 2015 14:01
GAS google docs auto sequencer
var _ = Underscore.load();
var HeadingCounter,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
HeadingCounter = (function() {
HeadingCounter.name = 'HeadingCounter';
HeadingCounter.HEADINGS = [DocumentApp.ParagraphHeading.HEADING1.toString(),
DocumentApp.ParagraphHeading.HEADING2.toString(),
# kondo @ kuga in ~
$ emacs --version
GNU Emacs 24.3.1
Copyright (C) 2013 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
# kondo @ kuga in ~
$ sshfs --version
@dot
dot / README.md
Last active January 13, 2016 11:16
wkhtmltopdf test
$ wkhtmltopdf --version
wkhtmltopdf 0.12.3-dev-79ff51e (with patched qt)

$ wkhtmltopdf --print-media-type --orientation Portrait --header-html ./header.html --footer-html ./footer.html body.html out.pdf

then

Loading pages (1/6)
Counting pages (2/6)

Resolving links (4/6)

@dot
dot / gist:ef050dfc3e694f7f5e3adb2372cc5fbd
Last active April 11, 2016 16:26
IP Address for Alfred
#!/bin/bash
_LOCALS=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')
LOCALS=(`echo ${_LOCALS}`)
#LOCAL=$(ipconfig getifaddr en0)
EXTERNAL=$(curl -4 --silent http://icanhazip.com)
LITEMS=""
for ((i=0; i<${#LOCALS[*]}; i++)) do
ITEM=$(cat <<-EOS
<item uid="localip_$i" arg="${LOCALS[i]}">
@dot
dot / Gemfile
Created March 29, 2017 09:57
Gemfile
source 'https://rubygems.org'
ruby '2.3.3'
gem 'browser'
gem 'carrierwave'
gem 'cells', '~> 3.0'
gem 'crummy'
gem 'date_validator'
gem 'devise'
gem 'devise-i18n'