This file contains 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
(ns node-tests.core | |
(:require [cljs.nodejs :as nodejs] | |
[cljs.core.async :as async :refer [<!]]) | |
(:require-macros [cljs.core.async.macros :refer [go]])) | |
(nodejs/enable-util-print!) | |
(defn clojureify [f] | |
(fn [] (js/console.log f))) |
This file contains 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
(ns node-tests.core | |
(:refer-clojure :exclude [exists?]) | |
(:require [cljs.nodejs :as nodejs] | |
[cljs.core.async :as async :refer [<!]]) | |
(:require-macros [cljs.core.async.macros :refer [go]])) | |
(nodejs/enable-util-print!) | |
;; Some helpers which help transform node style functions into clojurey ones | |
;; |
This file contains 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
;; input lines are like: | |
;; fs.truncate(path, len, callback) | |
;; fs.truncateSync(path, len) | |
;; fs.chown(path, uid, gid, callback) | |
;; fs.chownSync(path, uid, gid) | |
;; which are converted to: | |
;; (def ftruncate (core/clojureify fs.ftruncate)) | |
;; (def ftruncate-sync (core/clojureify-sync fs.ftruncateSync)) | |
;; ... |
This file contains 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
(defn- -single-line-input [value on-key placeholder] | |
(fn [value on-key placeholder] | |
[:input.form-control.input-lg {:type "text" | |
:value @value | |
:on-key-down on-key | |
:on-change #(reset! value (.. % -target -value)) | |
:placeholder placeholder | |
:autoFocus true}])) | |
(defn- single-line-input [value on-key placeholder] |
This file contains 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
2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] Server Shut Down. | |
2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] Server Shut Down. | |
2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] Server Shut Down. | |
2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] Server Shut Down. | |
2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] Server Shut Down. | |
2012-03-13 19:39:14-0500 [-] 2012-03-13 19:39:14-0500 [-] 2012-0 |
This file contains 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
# test.py | |
from twisted.application import internet, service | |
from twisted.python import log | |
from twisted.python.logfile import DailyLogFile | |
from twisted.internet.task import LoopingCall | |
import os |
This file contains 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
static inline real_t NormalizeAngle(real_t rAngle) { | |
real_t a = std::fmod(rAngle, 2 * pd::math::PI); | |
if (IsGreaterOrEqual(a, pd::math::PI)) | |
a = -2 * pd::math::PI + a; | |
else if (IsLessOrEqual(a, -pd::math::PI)) | |
a = 2 * pd::math::PI + a; | |
return a; | |
} |
This file contains 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
# fswatcher.py | |
# Watches a particular directory for files with corresponding .lock files | |
# | |
from twisted.internet import reactor | |
import os | |
class DirectoryWatcher(object): | |
def __init__(self, dirname, interval=1.0): | |
self.dirname = dirname |
This file contains 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
void write_rtp(std::ostream& os, const char *rtp_data, int length) { | |
unsigned short len = htons((unsigned short)length); | |
os.write((char*)&len, sizeof(len)); | |
os.write(rtp_data, length); | |
} |
This file contains 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
TxIVR do | |
say "Hello, good morning" | |
play "http://s3.amazon.com/verma/company.mp3" | |
dialog do | |
play "http://s3.amazon.com/verma/menu.mp3" | |
option key: "1", speech: "balance" do | |
say do | |
get "http://vendor.com/newcall/balance" |