I hereby claim:
- I am rmoch on github.
- I am rmoch (https://keybase.io/rmoch) on keybase.
- I have a public key ASCqnaGcmWq-jum-dPkg0nr3jvgPZD0Y4D8RhbZlGEQ_QQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
parseArticlesAttachments: function() { | |
for (var idx1 = 0; idx1 < this.state.articles.length; idx1++) { | |
var item = this.state.articles[idx1]; | |
if (item.source === 'feed') { | |
if (item.attachments) { | |
for (var idx2 = 0; idx2 < item.attachments.data.length; idx2++) { | |
var att = item.attachments.data[idx2]; | |
console.log('*****', att.type) | |
if (att.type === 'album') { | |
console.log('title ', att.title) |
As configured in my dotfiles.
start new:
tmux
start new with session name:
/** @jsx React.DOM */ | |
// base on http://jsfiddle.net/spicyj/M6h22/ | |
function copy(obj) { | |
var newObj = {}; | |
for (var key in obj) { | |
if (obj.hasOwnProperty(key)) { | |
newObj[key] = obj[key]; | |
} |
class CheckBoxBootstrapSwitch(CheckboxInput): | |
"""Django widget for bootstrap switch HTML widget: http://www.bootstrap-switch.org/ | |
Options can be provided through 'switch' argument: | |
switch = forms.BooleanField(required=False, label=_(u"bootstrap switch"), | |
widget=CheckBoxBootstrapSwitch(switch={'size': 'small', 'on': 'warning', 'text-label': 'Switch Me'})) | |
""" | |
def __init__(self, switch=None, *args, **kwargs): | |
self.switch = switch or {} | |
super(CheckBoxBootstrapSwitch, self).__init__(*args, **kwargs) |
import re | |
# List of format available on Youtube | |
YOUTUBE_CHOICES = ("default", "hqdefault", "0", "1", "2") | |
# Default image if no thumbnail is found | |
NO_PREVIEW = "/static/img/no_preview.png" | |
def get_video_thumbnail(url, version="hqdefault"): |
def asciify(unistr): | |
"""Returns an ascii string converting accented chars to normal ones. | |
Unconvertible chars are just removed. | |
>>> asciify(u'Ééüçñøà') | |
Eeucna | |
""" | |
return unicodedata.normalize('NFKD', unicode(unistr)).encode('ascii', 'ignore') | |
# -*- coding: utf-8 -*- | |
import hashlib | |
import os | |
import urllib2 | |
from optparse import make_option | |
from BeautifulSoup import BeautifulSoup as bf | |
from django.conf import settings |
# Natural time since template tag i18n | |
from django import template | |
from django.utils.encoding import force_unicode | |
from django.utils.translation import ungettext, ugettext as _ | |
register = template.Library() | |
# from http://anandnalya.com/2009/05/20/humanizing-the-time-difference-in-django/ | |
MOMENT = 60 # duration in seconds within which the time difference | |
# will be rendered as 'a moment ago' |