Skip to content

Instantly share code, notes, and snippets.

View shuhei's full-sized avatar
🐶
This is fine

Shuhei Kagawa shuhei

🐶
This is fine
View GitHub Profile
@oelmekki
oelmekki / doc.md
Created December 30, 2015 19:37
Rails + Browserify + React + es7

1. Gemfile

gem 'browserify-rails', '1.5.0' # until fix: https://github.com/browserify-rails/browserify-rails/issues/101
gem 'react-rails'

Browserify-rails allows to use browserify within assets pipeline. React-rails is here only to allow to use #react_component (and thus, prerendering).

Note that jquery-rails can be removed from Gemfile, the npm version of jquery and jquery-ujs will be used instead.

@pixeltrix
pixeltrix / time_vs_datatime.md
Last active February 18, 2024 19:20
When should you use DateTime and when should you use Time?

When should you use DateTime and when should you use Time?

It's a common misconception that [William Shakespeare][1] and [Miguel de Cervantes][2] died on the same day in history - so much so that UNESCO named April 23 as [World Book Day because of this fact][3]. However because England hadn't yet adopted [Gregorian Calendar Reform][4] (and wouldn't until [1752][5]) their deaths are actually 10 days apart. Since Ruby's Time class implements a [proleptic Gregorian calendar][6] and has no concept of calendar reform then there's no way to express this. This is where DateTime steps in:

>> shakespeare = DateTime.iso8601('1616-04-23', Date::ENGLAND)
=> Tue, 23 Apr 1616 00:00:00 +0000
>> cervantes = DateTime.iso8601('1616-04-23', Date::ITALY)
=> Sat, 23 Apr 1616 00:00:00 +0000

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

@seratch
seratch / bot.md
Last active August 29, 2015 14:05
Twitter Bot for Web Designers

Twitter Bot つくろうず

Twitter Bot ってどういう仕組み?

A Twitterbot is a program used to produce automated posts on the Twitter microblogging service, or to automatically follow Twitter users. (Wikipedia)

利用者の Twitter アカウント関する操作権限をもらって何かするもの。つぶやいたり、フォローしたり、ふぁぼったり。

Ruby でやる

@kevincennis
kevincennis / v8.md
Last active March 2, 2024 21:50
V8 Installation and d8 shell usage

Installing V8 on a Mac

Prerequisites

  • Install Xcode (Avaliable on the Mac App Store)
  • Install Xcode Command Line Tools (Preferences > Downloads)
  • Install depot_tools
    • $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
    • $ nano ~/.zshrc
    • Add path=('/path/to/depot_tools' $path)
@addyosmani
addyosmani / unit_testing.md
Last active July 27, 2020 05:17
Unit Testing Polymer Elements

Deprecated. See https://www.polymer-project.org/articles/unit-testing-elements.html for the latest version.

Unit Testing Polymer Elements

Note: this guide is a work-in-progress and will be added to the Polymer docs when it's ready. We have updated <seed-element> to include unit tests and this guide has been moved to Google docs. Expect a version on the Polymer site before the end of September.

After spending days working on your <super-awesome> Polymer element, you’re finally ready to share it with the rest of the world. You add the code for using it to your demo, iterate on it over time and come back to it one day when..uh oh. The demo broke because something has gone horribly wrong. Suddenly, <super-awesome> isn’t starting to look so great. Now you’re stuck trying to backtrack through your commit log to figure out how you broke the code. You’re not going to have a fun time.

If you’ve been working on the front-end for a while, even if you haven’t really played with Polymer elements before, this s

@ssig33
ssig33 / resque-kowareta.md
Last active March 18, 2022 02:46
Resque がぶっ壊れる話

起きたこと

Resque が謎の頓死を遂げる。 25 個とか起動してたはずのワーカーが気付いたら 0 個になってる。

対策

Resque のワーカー減らして daemon-spawn をやめて foreman + daemontools で resque を監視するようにした。

というだけではなんのこっちゃなので細かい話

Resque のワーカーがとにかく死にまくるのでなんなんだと思い調べていた。最初は monit とかで再起動させまくるかみたいに判断をする。この時点で Resque は daemon-spawn 経由で起動していた。

daemon-spawn 経由で起動している Resque のワーカーを monit で監視するというのは、大変に都合が悪い。複数あるワーカーのうちどれか一つが死んだみたいな場合でもまるごと再起動みたいな話になる。ならないかもしれないけど調べる時間の余裕がない(サービスに不具合があって金銭的な損害を垂れ流している状況なので)。

@floatdrop
floatdrop / thoughts.md
Last active January 18, 2021 03:54
Error management in gulp

#Error management in gulp

Sucking at something is the first step to becoming sorta good at something

No one can assure you, that plugins will run smooth in any circumstances (except for tests - they could), so neither should you convince anyone, that your plugin will never break. Only thing, that you could possibly do (if something gone wrong) - is gracefully inform your plugin user, that something went wrong and die.

We are will use this plugin from beginning to demonstrate error management. Suppose you have a task in gulpfile.js that contains this code (we modified it a little bit to be closer to real-usage):

var coffee = require('gulp-coffee');
@vlado
vlado / gist:7713285
Last active December 29, 2015 18:49 — forked from ericboehs/gist:7125105
Fork of @ericboehs Poltergeist hack to silence CoreText performance notes from phantomjs My changes: 1. to is now optional parameter, if not provided @write_io is used 2. option to easily add more messages to suppress (I added this one WARNING: Method userSpaceScaleFactor in class NSView is deprecated)
module Capybara::Poltergeist
class Client
private
def redirect_stdout(to = nil)
to ||= @write_io
prev = STDOUT.dup
prev.autoclose = false
$stdout = to
STDOUT.reopen(to)
@ericboehs
ericboehs / gist:7125105
Created October 23, 2013 19:30
Poltergeist hack to silence CoreText performance notes from phantomjs
module Capybara::Poltergeist
class Client
private
def redirect_stdout(to)
prev = STDOUT.dup
prev.autoclose = false
$stdout = to
STDOUT.reopen(to)
prev = STDERR.dup