This file contains hidden or 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
var data = { | |
title: 'fsdfsd', | |
titleZh: 'fsdfsd', | |
body: 'fsdf', | |
bodyZh: 'sdfsdf', | |
imageIds: '/uploads/tmp/image-3.png', | |
imageIdsZh: '' | |
}; | |
var z = Object.keys(data).filter(function(k) { |
This file contains hidden or 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
#!/bin/bash | |
# | |
# This script does this: | |
# launch an app if it isn't launched yet, | |
# focus the app if it is launched but not focused, | |
# minimize the app if it is focused. | |
# | |
# by desgua - 2012/04/29 | |
# modified by olds22 - 2012/09/16 | |
# - customized to accept a parameter |
This file contains hidden or 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
rm ~/.config/spotify -r && rm ~/.cache/spotify -r |
This file contains hidden or 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
Show hidden characters
[ | |
{ "keys": ["ctrl+7"], "command": "toggle_comment", "args": { "block": false } }, | |
{ "keys": ["ctrl+shift+7"], "command": "toggle_comment", "args": { "block": true } }, | |
{ "keys": ["ctrl+keypad_divide"], "command": "toggle_comment", "args": { "block": false } }, | |
{ "keys": ["ctrl+shift+keypad_divide"], "command": "toggle_comment", "args": { "block": true } }, | |
] |
This file contains hidden or 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
# coding=utf-8 | |
import json | |
from django.contrib import messages | |
class AjaxMessaging(object): | |
def process_response(self, request, response): |
This file contains hidden or 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
def format_currency(value, decimal_points=3, seperator=u'.', money=u'$'): | |
value = str(value) | |
if len(value) <= decimal_points: | |
return value | |
parts = [] | |
while value: | |
parts.append(value[-decimal_points:]) | |
value = value[:-decimal_points] | |
parts.reverse() | |
value = "%s %s" % (money, seperator.join(parts)) |
This file contains hidden or 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from datetime import datetime | |
all_dates = ['09-2012', '04-2007', '11-2012', '05-2013', '12-2006', '05-2006', '08-2007'] | |
sorted(all_dates, key=lambda x: datetime.strptime(x, '%m-%Y')) |
This file contains hidden or 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
# You might want to increase your video memory to at least 128 MB. For newer firmware version this can be done by adding the line on "/boot/config.txt" | |
gpu_mem=128 | |
(possible values: 16, 64, 128, 256) to your |
This file contains hidden or 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
# run as root | |
rm -rf /usr/local/lib/node_modules | |
brew uninstall node | |
brew install node --without-npm | |
echo prefix=~/.node >> ~/.npmrc | |
curl -L https://www.npmjs.com/install.sh | sh | |
# edit ~/.bash_profile |
This file contains hidden or 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
BROKER_URL = 'amqp://user:passwd@127.0.0.1/host' | |
BROKER_BACKEND = 'amqp' | |
CELERY_ACCEPT_CONTENT = ['json', 'pickle', 'msgpack', 'yaml'] | |
CELERY_TASK_SERIALIZER = 'json' | |
CELERY_RESULT_SERIALIZER = 'json' | |
CELERY_IGNORE_RESULT = False | |
CELERY_RESULT_BACKEND = 'amqp' | |
CELERY_SEND_TASK_ERROR_EMAILS = True | |
CELERYBEAT_SCHEDULER = "djcelery.schedulers.DatabaseScheduler" |