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 get_user_events(user_id, appname, new_flag=False): | |
""" | |
get the last 7 days events from reportevent table by user_id | |
param: user_id: the user id, appname: the app name | |
""" | |
if new_flag: | |
starttime = datetime.datetime.combine(datetime.date.today(), datetime.time.min) | |
else: | |
starttime = datetime.datetime.combine(datetime.date.today() - datetime.timedelta(days=6), | |
datetime.time.min) |
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 setuptools import setup, find_packages | |
import os | |
entrypoints = {} | |
console_scripts = entrypoints['console_scripts'] = [ |
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 | |
import redis | |
from ncelery import conf | |
class RedisClient(object): | |
""" | |
Singleton pattern | |
http://stackoverflow.com/questions/42558/python-and-the-singleton-pattern |
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 urllib2 | |
import sys | |
import time | |
import os | |
import random | |
from multiprocessing.dummy import Pool as ThreadPool | |
type_ = sys.getfilesystemencoding() | |
def rename(): |
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 | |
import redis | |
from ncelery import conf | |
class RedisClient(redis.StrictRedis): | |
""" | |
Singleton pattern | |
http://stackoverflow.com/questions/42558/python-and-the-singleton-pattern |
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
$(document).ajaxSend(function(event, xhr, settings) { | |
function getCookie(name) { | |
var cookieValue = null; | |
if (document.cookie && document.cookie != '') { | |
var cookies = document.cookie.split(';'); | |
for (var i = 0; i < cookies.length; i++) { | |
var cookie = jQuery.trim(cookies[i]); | |
// Does this cookie string begin with the name we want? | |
if (cookie.substring(0, name.length + 1) == (name + '=')) { | |
cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); |
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 | |
#celery web deploy | |
####################错误敏感#################### | |
set -e | |
####################参数个数校验、获取入参#################### | |
if [ $# != 1 ] ; then | |
echo -e "arguments number error" | |
exit 1; |
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 levelup = require('levelup'); | |
var db = levelup('./data'); //这里的路径就是物理存储数据的文件路径,建议不要放到项目中. | |
function put(key, value, callback) { | |
if (key && value) { | |
db.put(key, value, function (error) { | |
callback(error); | |
}) | |
} else { | |
callback('no key or value'); |
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 levelup = require('levelup'); | |
var db = levelup('./data'); //这里的路径就是物理存储数据的文件路径,建议不要放到项目中. | |
function put(key, value, callback) { | |
if (key && value) { | |
db.put(key, value, function (error) { | |
callback(error); | |
}) | |
} else { | |
callback('no key or value'); |
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
app.directive('angucomplete', function ($parse, $http, $sce, $timeout) { | |
return { | |
restrict: 'EA', | |
scope: { | |
"id": "@id", | |
"placeholder": "@placeholder", | |
"selectedObject": "=selectedobject", | |
"url": "@url", | |
"dataField": "@datafield", | |
"titleField": "@titlefield", |