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 wl.core | |
(:use compojure.core, aleph.core, aleph.http, hiccup.core, hiccup.page-helpers) | |
(:require [compojure.route :as route]) | |
(:gen-class)) | |
(def broadcast-channel (channel)) | |
(defn chat-handler [ch handshake] | |
(receive ch | |
(fn [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
public class Application extends Controller { | |
public static void index() { | |
render(); | |
} | |
public static void uploadPicture(Picture picture) { | |
picture.save(); | |
index(); | |
} |
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
shellPrompt <<= name(name => { state: State => | |
object devnull extends ProcessLogger { | |
def info(s: => String) {} | |
def error(s: => String) { } | |
def buffer[T](f: => T): T = f | |
} | |
val current = """\*\s+(\w+)""".r | |
def gitBranches = ("git branch --no-color" lines_! devnull mkString) | |
"%s:%s>" format ( | |
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
;; Adapted from "An empirical comparison of C, C++, Java, Perl, | |
;; Python, Rexx, and Tcl for a search/string-processing program" | |
;; by Lutz Prechelt | |
;; This was a 15-minute effort while listening to a talk. It's *not* | |
;; well thought-out or designed. | |
;; By Stuart Sierra, | |
;; @stuartsierra on Twitter |
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 ocr.main | |
(:use [clojure.string :only (split trim)]) | |
(:use [clojure.contrib.duck-streams :only (write-lines read-lines)]) | |
(:use [clojure.contrib.shell-out :only (sh)]) | |
(:use [clojure.contrib.math :only (sqrt)])) | |
; Input handling | |
(defn read-text-image-line [line] | |
(if (= "white" (last (split line #"[,:\s]+"))) "0" "1")) |
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> | |
<body> | |
<script src="phonegap-1.0.0.js"></script> | |
<script> | |
function uploadPhoto(imageURI) { | |
function win(r) { |
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
package com.fmpwizard.weyesowl.code | |
package snippet | |
/** | |
* Created by IntelliJ IDEA. | |
* User: Diego Medina | |
* Date: 11/20/11 |
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
/* | |
Copyright 2012-2021 Viktor Klang | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |
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
// Example Bot #2: The Tag Team | |
/** This bot spawns a collection of companion mini-bots which strive to remain at a configurable | |
* offset relative to their master bot. The master bot runs in large circles. | |
* | |
* The master bot uses the following state parameters: | |
* - heading = direction it is currently traveling | |
* - lastRotationTime = simulation the time when the bot last rotated its heading | |
* - lastSpawnTime = simulation time when the last mini-bot was spawned | |
* The mini-bots use the following state parameters: |
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 user = { | |
validateCredentials: function (username, password) { | |
return ( | |
(!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' } | |
: (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' } | |
: (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' } | |
: (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' } | |
: (!/^([a-z0-9_-]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' } | |
: false | |
); |
OlderNewer