Skip to content

Instantly share code, notes, and snippets.

View BigBlueHat's full-sized avatar
🎩
building Web things

BigBlueHat BigBlueHat

🎩
building Web things
View GitHub Profile
@ZER0
ZER0 / gist:10ef3b4b491c1dac3d70
Created August 7, 2014 16:25
ToggleButton with Global and Tab scope checked status
const { ToggleButton } = require('sdk/ui/button/toggle');
let globalToggle = ToggleButton({
id: 'my-global-toggle',
label: 'global function',
icon: './foo.png',
onChange: function() {
// delete the window state for the current window,
// automatically set when the user click on the button
this.state('window', null);
import json, traceback, requests, types
from collections import defaultdict
try:
from urllib.parse import urlencode
except ImportError:
from urllib import urlencode
class HypothesisUtils:
//Changes filter: "conflicts": "function(doc, req) { if(doc._conflicts) { return true; } else { return false; }}"
var dbase = 'focus';
var ddoc = 'app';
var sys = require('sys'),
couchdb = require('node-couchdb/lib/couchdb'),
client = couchdb.createClient(5984, 'crate.im'),
db = client.db(dbase),
changes = db.changesStream({filter: ddoc + '/conflicts'});
@agaoglu
agaoglu / USAGE.md
Created October 7, 2010 15:29
Simple CRUD function for couchapps

CRUD requires jquery.deepjson.js to work so it should be included

<script type="text/javascript" src="js/jquery.deepjson.js"></script>

Then you can assign whatever's in crud.json to a variable or you can put crud.json into your evently directory and let couchapp push it to your application.

Simplest way to use it is

RDBMS schema safety tips & common practices...
- define primary keys, even if artificial
- normalize your schema, and denormalize carefully
- use indexes judiciously
- distributed 2PC is a tool best left in the toolbox
- __many more known relational schema and modeling tips & tricks go here, but too lazy to type__
Document database / couchdb "schema" safety tips & common practices...
#!/usr/bin/env coffee
Couchstore = require './couchstore'
db = new Couchstore 'cstest.couch'
create = (cb) ->
docset = ((db.newdoc 'doc' + x, {testkey: 'testval' + x}) for x in [1..20])
db.save_multi docset, (err) ->
cb?()
dump = (fin) ->
<?php
if($currentCall->initialText) {
_log("*** User sent: " . $currentCall->initialText . " ***");
$result = ask("", array("choices" => "[ANY]"));
}
else {
call($numberToCall, array("timeout" => 60, "channel" => "TEXT", "network" => "SMS"));
$result = ask("Respond with a digit, any digit.", array("choices" => "[1 DIGIT]"));
}
@davidjrice
davidjrice / Vagrantfile
Created June 6, 2012 12:46
Ubunutu Lucid 64bit with Couchbase Server 2.0.0.dp4
# -*- mode: ruby -*-
# vi: set ft=ruby :
MIRROR = "http://packages.couchbase.com/releases/2.0.0-developer-preview-4"
VERSION = "couchbase-server-community_x86_64_2.0.0-dev-preview-4.deb"
# Vagrant: http://vagrantup.com
Vagrant::Config.run do |config|
# Use 64bit Ubuntu Lucid 10.04
config.vm.box = "lucid64"
@davidjrice
davidjrice / README.md
Created June 6, 2012 17:00
Vagrantfile for an Ubuntu lucid 32 or 64 bit VM with couchbase 2.0.0.dp4.1

Install Virtualbox

wget http://download.virtualbox.org/virtualbox/4.1.16/VirtualBox-4.1.16-78094-OSX.dmg
open VirtualBox-4.1.16-78094-OSX.dmg
# double click .pkg to install

Install vagrant

gem install vagrant --no-ri --no-rdoc
@tilgovi
tilgovi / export.py
Created August 25, 2012 07:57
Open Annotation export from okfn/annotator-store
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
import json
import jsonld
import pprint
import rdflib
import rdflib_jsonld