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
var sys = require('sys'), | |
Path = require('path'), | |
Mu = require('../mu'), | |
Script = process.binding('evals').Script; | |
exports.compile = compile; | |
exports.compilePartial = compilePartial; | |
function RenderEventEmitter(options) { | |
this.chunkSize = options.chunkSize || 1024; |
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
[org.clojars.ithayer/plaid-penguin "1.0.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
(ns ignacio.tfidf (:require [clojure.contrib.string :as string])) ;; Simple tfidf in clojure, for fun. | |
(def stopwords (set (string/split #"\n" (slurp "./stopwords.txt")))) | |
(defn tokenize [raw-text] ;; Lowercases and splits on non-letters, non-numbers. | |
(remove stopwords (string/split #"[^a-z0-9äöüáéíóúãâêîôûàèìòùçñ]+" (string/lower-case raw-text)))) | |
(defn idf2 [n-docs match] (Math/pow (Math/log (/ n-docs (count (keys match)))) 2)) | |
(defn index-one [fname] ;; Index for one file. Given an fname, returns a map of token -> map of (fname, count) |
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
def solve(eq,var='x'): | |
eq1 = eq.replace("=","-(")+")" | |
c = eval(eq1,{var:1j}) | |
return -c.real/c.imag | |
class CalculatorHandler: | |
def __init__(self): | |
self.log = {} | |
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
# Commands to initialize a simple heroku noir app. You can cut and paste them together. | |
# Install latest version of noir. If an older version is installed, remove it first. | |
lein plugin install lein-noir "1.1.0-SNAPSHOT" | |
# Create new noir project. | |
lein noir new noir-mongo-heroku | |
cd noir-mongo-heroku | |
# Create instructions for heroku. | |
echo 'web: lein run' > Procfile | |
# Create git repository. |
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
0: clojure.lang.LazySeq.sval(LazySeq.java:47) | |
1: clojure.lang.LazySeq.seq(LazySeq.java:63) | |
2: clojure.lang.RT.seq(RT.java:450) | |
3: clojure.core$seq.invoke(core.clj:122) | |
4: clojure.core$dorun.invoke(core.clj:2450) | |
5: clojure.core$doall.invoke(core.clj:2465) | |
6: pallet.core$parallel_lift.invoke(core.clj:720) | |
7: pallet.core$lift_nodes_for_phase$fn__8250.invoke(core.clj:742) | |
8: clojure.lang.ArrayChunk.reduce(ArrayChunk.java:58) | |
9: clojure.core$r.invoke(core.clj:797) |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<title>Ember Bug</title> | |
</head> | |
<body> | |
<script src="http://code.jquery.com/jquery-1.7.1.js"></script> | |
<script src="https://github.com/downloads/emberjs/ember.js/ember-0.9.1.js"></script> | |
<script type="text/x-handlebars" data-template-name="president"> | |
The President of the United States is {{name}}. |
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
(defmachine PaymentsMachine | |
(state :user-submitted | |
(on-in (fn [data] | |
(log/put "User submitted ...") | |
(send-email "...")))) | |
(state :sent-off | |
(on-in (fn [data] | |
(log/put "sent payment")))) | |
(state :error |
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
#!/usr/bin/env python | |
# | |
# This script reads packages from .s3. | |
# Given a directory, will pull all .s3 packages in it recursively. | |
# Or, if you specify a .s3 file, it will pull just that package. | |
# | |
# Copyright (C) 2010-2012 ReadyForZero (ReadyForZero.com) | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by |
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 create-security-header | |
"Given an optional environment (:stage, :prod), creates the authentication." | |
[credentials] | |
(let [soap-factory (SOAPFactory/newInstance) | |
security (.. soap-factory (createElement (QName. security-namespace "Security"))) | |
user-token (.. soap-factory (createElement (QName. security-namespace "UsernameToken"))) | |
username (.. soap-factory (createElement (QName. security-namespace "Username"))) | |
password (.. soap-factory (createElement (QName. security-namespace "Password")))] | |
(.. username (addTextNode (get credentials :username))) | |
(.. password (addTextNode (get credentials :password))) |
OlderNewer