As configured in my dotfiles.
start new:
tmux
start new with session name:
| #include <event.h> | |
| #include <evhttp.h> | |
| #include <pthread.h> | |
| #include <errno.h> | |
| #include <string.h> | |
| #include <fcntl.h> | |
| #include <sys/socket.h> | |
| #include <sys/types.h> | |
| #include <netinet/in.h> | |
| #include <iostream> |
| #include <stdio.h> | |
| #define ___VERSION 406001 | |
| #include "gambit.h" | |
| #include "somescheme.h" | |
| #define SCHEME_LIBRARY_LINKER ____20_somescheme__ | |
| ___BEGIN_C_LINKAGE |
| /* Dynamically create a page and navigate to it. | |
| (and include the page in browser history ) */ | |
| //create markup | |
| var newPage = $("<div data-role=page data-url=yay><div data-role=header><h1>YAY!!!!</h1></div><div data-role=content><img src=http://bukk.it/yay.gif /></div></div"); | |
| //append it to the page container | |
| newPage.appendTo( $.mobile.pageContainer ); | |
| //go to it |
| /* | |
| * This work is free. You can redistribute it and/or modify it under the | |
| * terms of the Do What The Fuck You Want To Public License, Version 2, | |
| * as published by Sam Hocevar. See the COPYING file for more details. | |
| */ | |
| /* | |
| * Easing Functions - inspired from http://gizma.com/easing/ | |
| * only considering the t value for the range [0, 1] => [0, 1] | |
| */ | |
| EasingFunctions = { |
As configured in my dotfiles.
start new:
tmux
start new with session name:
In mongodb it's easy to make at upsert, meaning update-or-insert by calling
db.collection.update({criteria}, {updated fields}, true)
The third parameter means - insert a new document if the document doesn't exist yet. So, for example, the following will insert a new document for the user if there's no document for that user yet, and will update it if it already exists:
db.users.update({user_id: '1234'}, {user_id: '1234', name: 'Ran'}, true)
| #lang racket | |
| (require ffi/unsafe | |
| ffi/unsafe/define) | |
| (define-ffi-definer define-libevent (ffi-lib "libevent")) | |
| ; Event Base | |
| (define evbase-ptr (_cpointer 'evbase)) | |
| (define-libevent event_base_new (_fun -> evbase-ptr)) | |
| (define-libevent event_base_dispatch (_fun evbase-ptr -> _void)) |
This article is now published on my website: A one-off git repo server.
| (menu-bar-mode -1) | |
| (tool-bar-mode -1) | |
| (scroll-bar-mode -1) | |
| (setq locale-coding-system 'utf-8) | |
| (set-terminal-coding-system 'utf-8) | |
| (set-keyboard-coding-system 'utf-8) | |
| (set-selection-coding-system 'utf-8) | |
| (prefer-coding-system 'utf-8) |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000