This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Chat extends React.Component { | |
constructor(props) { | |
super(); | |
this.state = { | |
users: [], | |
messages:[], | |
text: '', | |
status: 'userEnter' | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
class Chat extends React.Component { | |
componentWillMount () { | |
} | |
render () { | |
return ( | |
<div> | |
<Modal message={this.props.modal} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ChatRoom> | |
<Modal /> | |
<LeftPane> | |
<ChannelList /> | |
<UserList /> | |
</LeftPane> | |
<RightPane> | |
<Chat /> | |
<ChatUserInput /> | |
</RightPane> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\{% trans ([^\{%]+?) %\} | |
{gettext($1)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
errornous_block() | |
except: | |
import sys, traceback, pdb | |
type, value, tb = sys.exc_info() | |
traceback.print_exc() | |
pdb.post_mortem(tb) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git status -s | awk '{print $2}' | sed 's/\(.*\)/rsync -cav \1 user@remote.server.com:~\/\1/' | sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function debugIf(condition) { // TODO: multi-args | |
var shouldDebug; | |
if (typeof condition === 'function') { | |
shouldDebug = condition(); | |
} else { | |
shouldDebug = condition; | |
} | |
if (shouldDebug) debugger; | |
} |