Skip to content

Instantly share code, notes, and snippets.

👋
Hello!

Keitaroh Kobayashi keichan34

👋
Hello!
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
View puma_capacity_to_cloudwatch.rb
module PumaCapacityToCloudwatch
require 'puma_capacity_to_cloudwatch/utilization'
require 'puma_capacity_to_cloudwatch/publish'
class Error < StandardError; end
def self.run
sleep 10 # wait for puma to boot up
return unless defined?(Puma)
@jeremy-w
jeremy-w / blurb.fish
Created Mar 10, 2017
Fish function to create or reply to a social post on 10 Centuries. MPLv2
View blurb.fish
function blurb --description Post\ to\ 10C.\\nblurb\ post\ MESSAGE\\nblurb\ POST_ID\ REPLY --argument reply_id message
set -l token $TEN_CENTURIES_API_TOKEN
set -l endpoint https://api.10centuries.org/content/write
set -l usage 'blurb: post or reply to a message on 10C
Usage:
blurb post MESSAGE
Post a new blurb
@facto
facto / Gulpfile.js
Last active Jul 10, 2019
Replacing Brunch with Gulp in Phoenix
View Gulpfile.js
// Contains support for: SASS/SCSS, concatenation, and minification for JS and CSS
var gulp = require('gulp');
var sass = require('gulp-ruby-sass');
var concat = require('gulp-concat');
var compress = require('gulp-yuicompressor');
View kaminari_initializer.rb
Kaminari.configure do |config|
# config.default_per_page = 25
# config.max_per_page = nil
# config.window = 4
# config.outer_window = 0
# config.left = 0
# config.right = 0
# config.page_method_name = :page
# config.param_name = :page
end
@jeremy-w
jeremy-w / pipe.rs
Last active Aug 29, 2015
Implements Elixir's |> for Rust as pipe!.
View pipe.rs
/*
* Compile with:
* rustc -Z unstable-options --pretty expanded pipe.rs
*/
/* @file pipe.rs
* @author Jeremy W. Sherman (GitHub: @jeremy-w)
* @license ISC
*
* Implements and demonstrates use of the "pipe" (aka "thread-first") macro.
*/
@chrismccord
chrismccord / gist:9434b8fa208b3aae22b6
Last active Aug 29, 2015
Phoenix Upgrade Instructions 0.7.x to 0.8.0
View gist:9434b8fa208b3aae22b6

Channel Changes

The channel layer received significant features and an overhaul of the topic abstraction. Upgrade your 0.7.x channels should only require a few simple steps.

Notable changes:

  • An updated version of phoenix.js is required, replace your priv/static/js/phoenix.js with https://github.com/phoenixframework/phoenix/blob/v0.8.0/priv/static/js/phoenix.js
  • "topic" is now just an identifier. You join topics, broadcast on topics, etc. Channels are are dispatched to based on topic patterns in the router.
  • Channel callbacks in 0.8.0 introduce the concept of outgoing events. Prior to 0.8.0, chanenls only processed incoming events via the event/3 callbacks. In 0.8.0, event/3 has been renamed to handle_in/3, and outgoing events callbacks can be defined via handle_out/3
  • All channel callbacks, such as join/3, leave/2, handle_in/3, and handle_out/3 now accept the socket as the last argument. This mimicks GenServer APIs
  • The return signature of handle_in, `handle_
@marcoarment
marcoarment / ATPLogoView.m
Created Apr 29, 2014
Source for the Accidental Tech Podcast (ATP) T-Shirt
View ATPLogoView.m
// Source for the Accidental Tech Podcast (ATP) T-Shirt:
// http://www.marco.org/2014/04/29/atp-shirts
//
// By Marco Arment, April 28, 2014. MIT license.
@implementation ATPLogoView
- (void)drawRect:(CGRect)rectIgnored
{
NSString *fontName = @"MyriadPro-Semibold";
@Einkoro
Einkoro / hhvm_setcookie_fix.php
Last active Aug 29, 2015
Must-use plugin for a quick and dirty work around for HHVM indexing cookies by name and overwriting WordPress's logged_in and auth cookies.
View hhvm_setcookie_fix.php
<?php
/**
* Plugin Name: WP HHVM setcookie fix
* Plugin URI: http://bitpiston.com/
* Description: Quick n dirty alternative to setcookie() to work around HHVM indexing cookies by name and overwriting multiple cookies of the same name
* Author: BitPiston Studios
* Author URI: http://bitpiston.com/
* Version: 1.0
* Licence: BSD
*/
@octocat
octocat / .gitignore
Created Feb 27, 2014
Some common .gitignore configurations
View .gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@maxim
maxim / rails_load_path_tips.md
Last active Aug 21, 2019
How to use rails load paths, app, and lib directories.
View rails_load_path_tips.md

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

You can’t perform that action at this time.