Skip to content

Instantly share code, notes, and snippets.

View dot's full-sized avatar
😇

Shuhei KONDO dot

😇
View GitHub Profile
@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(),
@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 / 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 / config
Created January 21, 2014 07:43
svn configuration
[miscellany]
enable-auto-props = yes
[auto-props]
* = svn:needs-lock=true
@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 / 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 / sparql.rb
Last active December 11, 2015 06:58 — forked from ktym/sparql.rb
#!/usr/bin/env ruby
require "rubygems"
require "net/http"
require "uri"
require "cgi"
require "json" # gem install json
require 'pathname'
class SPARQL
# require 'coffee-script'
# fb = require './fizzbuzz'
# console.log(fb.fizzbuzz v for v in [1..15])
exports.fizzbuzz = (v)->
f = not(v % 3)
b = not(v % 5)
unless f or b
return v
"#{if f then 'Fizz' else '' }#{if b then 'Buzz' else ''}"
@dot
dot / chdir.cc
Created September 7, 2011 08:28
test for chdir & Poco::Path
#include <Poco/Path.h>
#include <Poco/Format.h>
#include <iostream>
#include <unistd.h>
int main(int argc, char** argv) {
std::cout << Poco::format(" current() (Current directory): %s", Poco::Path::current()) << std::endl;
Poco::Path p(Poco::Path::current());
std::cout << Poco::format(" .. : %s", p.forDirectory("..").absolute().toString()) << std::endl;
@dot
dot / main.cc
Created September 6, 2011 09:25
messagepack with raw_ref
// g++ -g -O0 -Wall -fPIC -I/usr/local/include/ -L/usr/local/lib/ -lmsgpack main.cc -o main
#include <iostream>
#include <msgpack.hpp>
struct Result {
public:
msgpack::type::raw_ref message;
Result() {}
MSGPACK_DEFINE( message);