Skip to content

Instantly share code, notes, and snippets.

import { Rx } from '@cycle/core'
import { h } from '@cycle/dom'
import CodeMirror from 'codemirror'
class CodeMirrorRenderer {
constructor(events) {
this.events = events;
}
hook(node, propertyName, previousValue) {

前置き

elixir が結局速いのかそうでもないのか検証してみたいから、誰か isucon4 qual のアプリを elixir で。

— そのっつ (SEO Naotoshi) (@sonots) 2015, 9月 5
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

とかてきとうなことをつぶやいていたら、なんと @ma2ge さんが実装してくれました!

@sonots まずは動くところまで作ってみました。手元のマシンですが ruby との比較結果だけ README に載せています。benchmarker は通ったのですがバグなどあるかもしれません。 https://t.co/6WaI4LAbME

— taka (@ma2ge) 2015, 9月 7
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
@sorah
sorah / a.sh
Created October 17, 2014 05:20
Homebrew relink if necessary
#!/bin/bash
for keg in /usr/local/Library/LinkedKegs/*; do
kegname="$(basename $keg)"
dir="$(find $keg/ -maxdepth 1 -type d | grep '\/\(sbin\|bin\|etc\|var\|lib\|include\|libexec\|share\)$' | head -n1)"
[ -z "${dir}" ] && continue
testee="$(find $dir -type f | head -n1 | sed -e "s|${keg}||")"
[ -f /usr/local/$testee ] || (echo $keg && brew unlink $kegname; brew link --force $kegname)
done
$ jruby -v
jruby 1.7.5.dev (1.9.3p392) 2013-09-04 090d5dd on Java HotSpot(TM) 64-Bit Server VM 1.7.0_25-b15 [darwin-x86_64]
$ time jruby -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xverify:none -e 'require "rails"'
jruby -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xverify:none -e 5.18s user 0.47s system 136% cpu 4.142 total
$ time jruby -e 'require "rails"'
jruby -e 'require "rails"' 14.60s user 0.44s system 202% cpu 7.444 total
brew install cmigemo
mkdir -p ~/.vim/bundle/manual/migemo/plugin
cd ~/.vim/bundle/manual/migemo/plugin
curl -L -O https://raw.github.com/koron/cmigemo/master/tools/migemo.vim
vi ~/.vimrc
NeoBundle 'migemo', {'type' : 'nosync', 'base' : '~/.vim/bundle/manual'}
@twetzel
twetzel / partial_helper.js.coffee
Created June 21, 2012 04:02
.eco - Partials .. Render Partials in .jst.eco templates (for Rails + Spine / maybe Backbone)
# Render Partials in ECO-Templates like in Rails-ERB
#
# usefull to clean up structure in spine.js and other js-mvc´s like backbone
#
# usage:
# <%- render_partial 'path/to/partial' %> .. will render ../spine-app/views/path/to/_partial.jst.eco
# <%- render_partial 'path/to/partial', foo: 'bar' %> .. will render ../spine-app/views/path/to/_partial.jst.eco .. locals = @foo
#
window.render_partial = ( path, options = {} ) ->
# add the leading underscore (like rails-partials)
@stevebourne
stevebourne / Gemfile
Created April 15, 2012 19:28
Add facebook auth to a Clearance app, using omniauth-facebook
gem 'omniauth'
gem 'omniauth-facebook'
gem 'clearance'
@waltarix
waltarix / tmux-do-not-combine-utf8.patch
Last active May 29, 2022 09:58
tmux: Fix a problems with displaying Ambiguous-width, Japanese Dakuten and Handakuten signs.
diff --git a/screen-write.c b/screen-write.c
index 15f8d07..8a175a6 100644
--- a/screen-write.c
+++ b/screen-write.c
@@ -1334,6 +1334,7 @@ screen_write_cell(struct screen_write_ctx *ctx, const struct grid_cell *gc)
ctx->cells++;
/* If the width is zero, combine onto the previous character. */
+ /*
if (width == 0) {
@webmat
webmat / backbone-monkey-patch.js
Created May 4, 2011 15:30
Getting pagination information from headers with Backbone
// Get the pagination information from the response headers
// Wrap Backbone.sync to save the pagination header on the response object.
Backbone.sync_with_pagination = function(method, model, success, error) {
var success_with_pagination = function(resp, status, xhr) {
resp.next_page = xhr.getResponseHeader('X-Next-Page');
return success(resp);
}
return Backbone.sync_without_pagination(method, model, success_with_pagination, error);
};
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
typeof(options) != 'undefined' || (options = {});
this.page = 1;
typeof(this.perPage) != 'undefined' || (this.perPage = 10);
},
fetch: function(options) {