Skip to content

Instantly share code, notes, and snippets.

View sairion's full-sized avatar
⚛️

Jaeho Lee (Jay) sairion

⚛️
View GitHub Profile
@sairion
sairion / style-mixin.js
Last active April 9, 2016 17:47
style-mixin.js
export const Display = {
None: { display: 'none' },
Block: { display: 'block' },
Inline: { display: 'inline' },
InlineBlock: { display: 'inline-block' },
NoneIf(cond) {
return cond ? Display.None : null;
},
BlockIf(cond) {
return cond ? Display.Block : null;
@sairion
sairion / native-mixed-click.js
Last active April 6, 2016 09:06
native-mixed-click.js
// To make the most of native browser click event
// Util.js
export function isPlainLeftClick(event) {
return !(event.button !== 0 || event.altKey || event.metaKey || event.ctrlKey || event.shiftKey);
}
// index.js
import { isPlainLeftClick } from 'Util';
el.on('click', event => {
class Chat extends React.Component {
constructor(props) {
super();
this.state = {
users: [],
messages:[],
text: '',
status: 'userEnter'
};
@sairion
sairion / chat.jsx
Last active November 15, 2015 20:10
import React from 'react';
class Chat extends React.Component {
componentWillMount () {
}
render () {
return (
<div>
<Modal message={this.props.modal} />
<ChatRoom>
<Modal />
<LeftPane>
<ChannelList />
<UserList />
</LeftPane>
<RightPane>
<Chat />
<ChatUserInput />
</RightPane>
@sairion
sairion / gist:981c23c98ba7928c991c
Created November 12, 2015 14:48
trans block -> gettext
\{% trans ([^\{%]+?) %\}
{gettext($1)}
@sairion
sairion / trackback.py
Created November 12, 2015 11:22
traceback
try:
errornous_block()
except:
import sys, traceback, pdb
type, value, tb = sys.exc_info()
traceback.print_exc()
pdb.post_mortem(tb)
@sairion
sairion / git-rsync.sh
Created October 12, 2015 09:56 — forked from paydro/git-rsync.sh
rsync changed files in a git repo to a remote server
git status -s | awk '{print $2}' | sed 's/\(.*\)/rsync -cav \1 user@remote.server.com:~\/\1/' | sh
@sairion
sairion / m2crypto.sh
Last active October 12, 2015 07:08
How to deal with M2Crypto on OSX and SWIG 3.0.5
brew update
brew install swig
# M2Crypto is not being updated for a long time, and you will likely run into
# problem like https://github.com/martinpaljak/M2Crypto/issues/60
# So just install patch provided by @mtrmac: https://github.com/martinpaljak/M2Crypto/pull/75
# This solved my problem on OSX 10.10 Yosemite.
pip install git+git://github.com/mtrmac/M2Crypto.git@1f920615daafb5ae8dc8e11831459ebe986d3509
@sairion
sairion / debugwhen.js
Created September 10, 2015 07:46
debugwhen.js
function debugIf(condition) { // TODO: multi-args
var shouldDebug;
if (typeof condition === 'function') {
shouldDebug = condition();
} else {
shouldDebug = condition;
}
if (shouldDebug) debugger;
}