Skip to content

Instantly share code, notes, and snippets.


Keitaroh Kobayashi keichan34

Block or report user

Report or block keichan34

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
keichan34 / active_record_marshalable.rb
Created Sep 5, 2013
Get Marshal.dump and Marshal.load to load cached association objects ( Whatever.includes(:example_models) ), as well.
View active_record_marshalable.rb
module ActiveRecordMarshalable
def marshal_dump
[attributes, self.association_cache, instance_variable_get(:@new_record)]
def marshal_load data
send :initialize, data[0]
instance_variable_set :@association_cache, data[1]
instance_variable_set :@new_record, data[2]
keichan34 / package.json
Created Jul 23, 2018
hacking CRA to work with babel-plugin-relay
View package.json
"scripts": {
"build": "node ./setup && react-scripts build"
keichan34 /
Last active Mar 12, 2017 — forked from jeremy-w/
Fish function to create or reply to a social post on 10 Centuries. MPLv2
function blurb --description Post\ to\ 10C.\\nblurb\ post\ MESSAGE\\nblurb\ POST_ID\ REPLY --argument reply_id message
set -l endpoint
set -l usage 'blurb: post or reply to a message on 10C
blurb post MESSAGE
Post a new blurb

Keybase proof

I hereby claim:

  • I am keichan34 on github.
  • I am sleepy_keita ( on keybase.
  • I have a public key ASASuKTnKfWXIiwyRu4jyTDn-i8LUj1qZLrKHeNPRBtlsAo

To claim this, I am signing this object:

keichan34 / hi.exs
Last active Sep 17, 2016
compile-time list
View hi.exs
defmodule Hi do
keys = ~w(hello there)a
for {key, idx} <- Enum.with_index(keys) do
def index_of_key(unquote(key)) do
{:ok, unquote(idx)}
def key_at_index(unquote(idx)) do
{:ok, unquote(key)}
keichan34 / .babelrc
Last active Sep 11, 2016
Sample Phoenix + Brunch (Babel) + Mocha test setup for unit tests
View .babelrc
"presets": ["es2015"]
keichan34 /
Last active May 26, 2016
I got tired of loading nvm every time in my fish shell, so this.
# Requires bass and nvm
# bass:
# nvm:
function nvm
set -g NVM_LOADED "1"
bass source ~/.nvm/ ';' nvm $argv
function ensure_nvm_loaded
keichan34 / ses_credential_generator.exs
Created Mar 26, 2016
Amazon SES SMTP Credential Generator
View ses_credential_generator.exs
#!/usr/bin/env elixir
key = case System.argv do
[key | _] -> key
_ ->
IO.puts "Usage: ses_credential_generator.exs [AWS Secret Access Key]"
keichan34 / execute-cron-on-all-sites.php
Created Jan 29, 2014
A simple script, intended to be run in the context of a WordPress install -- `wp-cli`'s `eval-file` is the easiest way -- to ping the cron of all sites registered in the network.
View execute-cron-on-all-sites.php
$start_date = date_i18n('Y/m/d H:i:s');
$start_time = microtime(true);
echo "Start site-wide wp-cron at $start_date\n";
$sites = wp_get_sites();
foreach ($sites as $site) {
$url = "http://" . $site['domain'] . $site['path'];
keichan34 / php_stdclass_init.php
Created Oct 3, 2013
PHP stdClass initialization vs array-to-object typecast
View php_stdclass_init.php
$start = microtime(true);
for($i=0;$i<1000000;$i++) {
$a = new stdClass();
$a->hello = 'there';
$end = microtime(true);
You can’t perform that action at this time.