Skip to content

Instantly share code, notes, and snippets.

"""
I've been thinking lately about how perfect Redis would be for storing a
simple social graph. I posited that it would be relatively few lines of code,
and that it'd be clean code too. So here it is: a basic social graph built on Redis.
"""
class FriendGraph(object):
def __init__(self, ring):
self.ring = ring
<script>
$ = bonline.require("jquery");
$(document).ready(function() {
$.fancybox.init();
}
</script>
@conglin
conglin / Jiaplatform设备初始化流程.md
Created April 27, 2017 06:57
Jiaplatform设备初始化流程

#Jiaplatform设备初始化流程文档

##1. 第一次打开设备或者用户reset设备后: 设备应当以如下方式启动wifi热点:

ssid:
Jiaplatform_device_<设备uuid>
密码为空

同时在设备上启动http服务器等待app端连接,服务器地址在 http://192.168.1.2/setup_wifi/

$=bonline.require("jquery");
Cookies = bonline.require("cookie");
var set_latitude= $.ajax({
type : "POST",
cache : false,
url : "/edit/save/root/latitude/",
data : {value:'54.8287'},
headers : { "X-CSRFToken" : Cookies.get("csrftoken") },
@conglin
conglin / set_lang.js
Created June 1, 2018 07:17
set html.lang attr
$=bonline.require("jquery");
Cookies = bonline.require("cookie");
var saveNode = function(ref, kind, val) {
return $.ajax({
type : "POST",
cache : false,
url : `/edit/save/${ref}/${kind}/`,
data : {value:val},
headers : { "X-CSRFToken" : Cookies.get("csrftoken") },
<select name="">
<option value="USD" selected="selected">United States Dollars</option>
<option value="EUR">Euro</option>
<option value="GBP">United Kingdom Pounds</option>
<option value="DZD">Algeria Dinars</option>
<option value="ARP">Argentina Pesos</option>
<option value="AUD">Australia Dollars</option>
<option value="ATS">Austria Schillings</option>
<option value="BSD">Bahamas Dollars</option>
<option value="BBD">Barbados Dollars</option>
@conglin
conglin / my-first-module.md
Created November 22, 2018 10:00 — forked from tmpvar/my-first-module.md
how to create your very first node.js module and publish it to the npm registry

building your first node module

This is pretty simple, lets dive in!

choose a name

Find a name that isn't taken and clearly describes what your module is doing

$ npm view your-first-node-module
import orm
from common.models import Lead, Kinds
import sqlalchemy as sa
from sqlalchemy import or_
with orm.session_scope() as session:
lead = session.query(Lead).filter(
Lead.source == 'Partner',
or_(
@conglin
conglin / delete_site.py
Last active February 11, 2020 14:08 — forked from crizCraig/gist:2816250
Deleting all entities in a namespace on Google App Engine with Python.
DEV = os.environ['SERVER_SOFTWARE'].startswith('Dev')
APP_ID = os.environ['APPLICATION_ID']
TESTSPACE = 'test.site3.bonlineapp.com' #change this to the namespace to delete
def deleteDBandMemcache():
"""Delete all entities in a namespace."""
from google.appengine.api import namespace_manager
######################################
namespace_manager.set_namespace(TESTSPACE)
######################################
import requests
url='http://localhost:8000/voip-provisioning/v1/enterprises/4757724199815007735/welcome-attendant/958281871615315435/audio/upload/'
files={'file': ("Took_my_love_away.mp3", open('Took_my_love_away.mp3','rb'), 'audio/mpeg')}
r=requests.post(url, files=files)