Skip to content

Instantly share code, notes, and snippets.

View dittos's full-sized avatar
💥
뿌슝빠슝

Taeho Kim dittos

💥
뿌슝빠슝
View GitHub Profile
@dittos
dittos / gist:8802445
Last active August 29, 2015 13:56
Custom Twitter CSS
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("twitter.com") {
.is-preview img {
transition: 0.2s linear opacity;
}
.stream-item:not(.open) .is-preview,
.stream-item:not(.open) .multi-photo {
@dittos
dittos / gist:b85564b263d637d33ee2
Created July 2, 2014 08:55
React PromiseMixin
var PENDING = 0,
FULFILLED = 1,
REJECTED = 2;
export var PromiseMixin = {
getInitialState: function() {
return {promiseState: PENDING};
},
componentWillMount: function() {
/** @jsx React.DOM */
import React from 'react';
var popupId = 0;
function addStyle(doc, cssCode) {
var styleElement = doc.createElement("style");
styleElement.type = "text/css";
var head = doc.getElementsByTagName("head")[0];
var NewStatus = React.createClass({
render: function() {
return <div className="new-status">
<h2>New monolog</h2>
<form action="" onSubmit={this.handleSubmit}>
<textarea ref="text" /><br />
<input type="submit" value="Post" />
</form>
</div>;
},
@dittos
dittos / gist:60e80da8e8d11b475c9f
Created August 12, 2014 14:00
Example Upstart Configuration
start on runlevel [2345]
stop on runlevel [016]
respawn
setuid www-data
setgid www-data
env PORT=11000
chdir /home/ditto/animeta
exec env/bin/gunicorn animeta.wsgi --bind 127.0.0.1:$PORT --error-logfile -
class Handler(BaseHandler):
@property
def db(self):
if not hasattr(self, '_db'):
self._db = Session(bind=self.app.engine)
return self._db
def teardown_request(self):
db = getattr(self, '_db', None)
if db:
@dittos
dittos / IconButton.rsx
Last active August 29, 2015 14:14
React Component Container Format
name: IconButton
props:
text:
required: true
type: string
description: A button text.
example: Click Me!
icon:
required: true
type: string
@dittos
dittos / c60.py
Last active August 29, 2015 14:17
@Code_60: Sorting
import sys
from wand.image import Image
from wand.color import Color
from wand.drawing import Drawing
with Image(filename=sys.argv[1]) as img:
pixels = []
for row in img:
for col in row:
pixels.append(col)
@dittos
dittos / Relay Internals.md
Last active August 29, 2015 14:27
Relay Internals
  • 쓰레드가 N개인 쓰레드 풀이 있습니다.
  • 들어오는 태스크에는 Key가 있어서, Key가 같은 태스크끼리는 들어오는 순서대로 실행되어야 합니다.

예:

Pool Size = 4