Skip to content

Instantly share code, notes, and snippets.

seoyoochan /
Last active May 2, 2016
Install Essential Atom Packages and Themes

apm install advanced-open-file atom-beautify atom-pair autoclose-html autocomplete-html-entities autocomplete-ruby autoprefixer dash emmet environment linter linter-eslint linter-jscs merge-conflicts react redux-snippets go-plus file-icons

seoyoochan / vim-movment.txt
Created May 1, 2016
Vim: Movement Commands
View vim-movment.txt
Move to the end of a word.
Move forward to the beginning of a word.
Move forward three words.
Move forward a WORD (any non-whitespace characters).
seoyoochan / ES6-TDZ-explain.txt
Created Apr 30, 2016
ES6 TDZ(Temporary Dead Zone)
View ES6-TDZ-explain.txt
The w in the w + 1 default value expression looks for w in the formal parameters' scope,
but does not find it, so the outer scope's w is used.
Next, The x in the x + 1 default value expression finds x in the formal parameters' scope,
and luckily x has already been initialized, so the assignment to y works fine.
However, the z in z + 1 finds z as a not-yet-initialized-at-that-moment parameter variable,
so it never tries to find the z from the outer scope.
As we mentioned in the "let Declarations" section earlier in this chapter,
ES6 has a TDZ, which prevents a variable from being accessed in its uninitialized state.
seoyoochan /
Created Mar 25, 2016
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
seoyoochan /
Created Mar 19, 2016 — forked from mik01aj/
How to use Tether with React

Tether is a great library for positioning stuff (tooltips, modals, hints, etc) in your web app.

But, as I use React, it was pretty problematic for me, as Tether mutates the DOM and React breaks miserably when it sees mutated DOM. The solution is to have the tethered element outside the part of the DOM tree which is controlled by React (in this case, I use document.body).

That's why I created 2 helpers to use Tether with React.

The first one, TetheredElement is a plain JS helper to create a new element, attach it to some other one via Tether, and populate it with some React component.

The second one, TetherTarget is a React component and it uses TetheredElement to integrate it further with React, so that you can attach components to each other with Tether, without leaving the cozy React/JSX world and worrying about manual DOM operations. Just write:

seoyoochan / I18nRuntimePlugin.js
Created Mar 17, 2016 — forked from valscion/I18nRuntimePlugin.js
Venuu I18n Webpack integration
View I18nRuntimePlugin.js
var ConstDependency = require('webpack/lib/dependencies/ConstDependency');
var NullFactory = require('webpack/lib/NullFactory');
var _ = require('lodash');
function I18nRuntimePlugin(options) {
options = options || {};
this.functionNames = options.functionNames || ['I18n.t', 'I18n.translate'];
this.translationsPlaceholder = options.translationsPlaceholder || 'I18N_RUNTIME_TRANSLATIONS';
this.fullTranslations = options.fullTranslations || {};
seoyoochan /
Created Mar 17, 2016 — forked from jhilden/
Setup for using i18n-js together with react-rails i18n-js for server side prerendering

When using react-rails for an internationalized app it makes a lot of sense to use i18n-js for translations, so that you can reuse the the strings from your rails app's .yml files (and all the tooling & services that exist around that).

When you use the prerender feature of react-rails you face 2 problems:

  • The first is that translation.js & i18n.js from i18n-js need to be loaded inside the server-side JS prerendering processes, which is achieved by loading them inside the components.js.
  • The second problem is the server processes need to be aware of the current locale of each HTTP request. This is done by adding a custom renderer and using the before_render hook to configure i18n-js accordingly for each render call.
seoyoochan / largest
Last active Feb 13, 2016
Return the largest int from an array of numerical strings
View largest
#! /usr/bin/env ruby
# Author: Yoochan Seo
# Email:
# If you want this program executable,
# `chmod 755 largest`
./largest 99, 997, 101, 2, 33 # execute this program and pass your value
seoyoochan / rails http status codes
Created Feb 9, 2016 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
View rails http status codes
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
seoyoochan / rspec_model_testing_template.rb
Created Feb 6, 2016 — forked from kyletcarlson/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
View rspec_model_testing_template.rb
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
# @kyletcarlson
# This skeleton also assumes you're using the following gems: