Skip to content

Instantly share code, notes, and snippets.

db.report.aggregate([
{'$match': {
'date': {'$gte': yesterday}
}},
{'$group': {
'_id': {
'$let': {
'vars': {
'local_date': {'$add': ['$date', 9 * 60 * 60 * 1000]}
},
This file has been truncated, but you can view the full file.
[{"weight":[[[[-0.0384068377316,-0.13892742991447,-0.074116952717304],[-0.0043417760170996,-0.13482336699963,-0.05335071310401],[0.094891287386417,0.13990740478039,0.21070368587971]]],[[[0.13741871714592,0.068341165781021,-0.049014247953892],[0.0052761328406632,-0.020446205511689,0.047407131642103],[-0.018339443951845,-0.027100933715701,-0.0057863597758114]]],[[[0.17850013077259,0.051763921976089,-0.0062319315038621],[-0.019090188667178,-0.055008850991726,-0.14032724499702],[-0.051505457609892,-0.099252879619598,0.14686788618565]]],[[[0.011584693565965,0.041832812130451,0.22183129191399],[-0.017042856663465,-0.095366142690182,0.044966705143452],[-0.001104052294977,0.0075620785355568,-0.017687179148197]]],[[[0.056010495871305,-0.014734433032572,-0.0077268448658288],[-0.0037417802959681,0.049426376819611,0.011491533368826],[0.20122179389,-0.038716461509466,0.001358984853141]]],[[[-0.11974314600229,-0.096629768610001,0.022501574829221],[-0.15950687229633,0.016204258427024,-0.0048143183812499],[-0.005881851539015
@comfuture
comfuture / hello.js
Created September 10, 2010 13:56
nano framework for node.js
with (require('./nano')) {
get('/hello', 'Hello, world');
get('/index.html', readfile('index.html'));
static_file('/about.html');
get('/bye', function() {
return 'Bye~ ' + request.args['name'];
});
@comfuture
comfuture / ajaxize.js
Created September 16, 2010 11:31
ajaxize.js
function ajaxize(selector) {
$(selector).each(function(idx, el) {
el = $(el);
var opts = (el.attr('rel') || '').split(' ');
var hasOption = function(opt) { return opts.indexOf(opt) > -1 }
var pos = hasOption('before') ? 'Before' : 'After';
var toggle = hasOption('toggle');
var increase = hasOption('increase');
var inherit = hasOption('inherit');
var target_name = el.attr('target');
@comfuture
comfuture / jquery.oop.js
Created October 13, 2010 09:05
jQuery OOP extension
(function($){
$.Class = function(code){
var klass = function() {
var instance = (arguments[0] !== null && this.__init__ && typeof this.__init__ == 'function') ? this.__init__.apply(this, arguments) : this;
return instance;
};
$.extend(klass, this);
$.extend(klass.prototype, {
'bind': function(type, fn) {
this.__events__ = this.__events__ || {};
@comfuture
comfuture / gist:672902
Created November 11, 2010 17:56
sync local added file to remote git repository
on adding folder items to dropbox after receiving added_files
set firstFileName to the name of item 1 of added_files
set numFiles to count items in added_files
repeat with i from 1 to number of items in added_files
set posixPath to POSIX path of (item i of added_files as string) as string
do shell script "git add " & posixPath
end repeat
do shell script "git commit -a -m'added " & firstFileName & "...'"
do shell script "git push"
end adding folder items to
@comfuture
comfuture / juice.sample.js
Created December 2, 2010 05:30
sample juice usage
juice.namespace('sample');
juice.include('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js')
.css('http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/themes/flick/jquery-ui.css')
.require('ui.Form')
(function() {
juice.sample.Calendar = Class({
__init__: function() {
@comfuture
comfuture / __init__.py
Created December 17, 2010 09:25
minimal set of delicious.com backup source (using mongodb)
from pymongo import Connection
from BeautifulSoup import BeautifulSoup
from flask import Flask, render_template, request, redirect, url_for
from .util import normalize_url
app = Flask(__name__)
conn = Connection('localhost')
db = conn.test
bookmarkr = db.bookmarkr
@comfuture
comfuture / AlignBall.as
Created December 24, 2010 05:02
as3 coding convention and example
/**
* 객체들끼리 서로 밀어내며 자리를 찾아 지속적으로 동일한 간격을 유지하게 하는 프로그램 예제
* @author 거친마루 <comfuture@_GMAIL_COM_>
*/
package
{
import flash.display.DisplayObject;
import flash.display.Sprite;
import flash.events.Event;
@comfuture
comfuture / BMPDecoder.as
Created December 27, 2010 09:42
window BMP file format decoder - bigger but supports more
package jp.plaync.image.codec
{
import flash.display.BitmapData;
import flash.errors.IOError;
import flash.utils.ByteArray;
import flash.utils.Endian;
/**
* Windows BMP file decoder
* @see http://ntt.cc/2008/10/01/using-bmpdecoder-class-to-load-an-external-bmp-file-rle-compression-support.html