This file contains hidden or 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
| Pattern p = new Pattern("https?://[-\w]+\.\w[-\w/]*+"); | |
| Matcher m = new Matcher(p, text); | |
| return m.replaceAll("<a href=\"$0\">$0</a>"); |
This file contains hidden or 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
| ; Using "let" here, since in my real code I use the reference later. | |
| ; You could use "doto" if you just wanted to do a bunch of database | |
| ; operations and then close the db. | |
| (let [pref-db (HDB.)] | |
| (.open pref-db "user-prefs.hdb" (bit-or HDB/OWRITER HDB/OCREAT)) | |
| (.put pref-db "Hello World" "Saying Hi! to the big old world out there") | |
| (println (.get pref-db "Hello World")) | |
| (.close pref-db)) |
This file contains hidden or 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
| ; A wrapper to access Tokyo Cabinet from clojure | |
| (ns tokyo-cabinet | |
| ; exclude symbols we'll use in our API | |
| (:refer-clojure :exclude [use get])) | |
| (declare *db*) | |
| (defn get [key] (.get *db* key)) |
This file contains hidden or 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
| (tokyo-cabinet/use "trial.hdb" | |
| (tokyo-cabinet/put "Hello World" "Saying Hi! to the big old world out there") | |
| (println (tokyo-cabinet/get "Hello World"))) |
This file contains hidden or 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
| (let [channel-agents [ | |
| ; For every item in (:1 channels) (a list of channels), create | |
| ; an agent. Then do this for (:2 channels), which is a list of | |
| ; channels that belong in the second column. | |
| (map | |
| (fn [channel] | |
| (send-off | |
| (agent "") | |
| (fn [_] | |
| (flockr.channels/render-channel |
This file contains hidden or 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 (C) 1991,1993,1995,1997,1998,2003,2004 | |
| Free Software Foundation, Inc. | |
| This file is part of the GNU C Library. | |
| Contributed by Torbjorn Granlund ([email protected]). | |
| The GNU C Library is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU Lesser General Public | |
| License as published by the Free Software Foundation; either | |
| version 2.1 of the License, or (at your option) any later version. |
This file contains hidden or 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
| this.neilYoungModel = { items : [ | |
| {data:"On The Beach", year:"1974"}, | |
| {data:"Tonight's The Night", year:"1975"}, | |
| {data:"Harvest", year:"1972"}, | |
| {data:"Greendale", year:"2003"}, | |
| {data:"Broken Arrow", year:"1996"}, | |
| {data:"Everybody Knows...", year:"1969"}, | |
| {data:"Zuma", year:"1975"}, | |
| {data:"Unplugged", year:"1993"}, | |
| {data:"Harvest Moon", year:"1992"} |
This file contains hidden or 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 Animal = new Cobra.Class({ | |
| __init__: function(self) { | |
| self.breathes = true; | |
| } | |
| }); | |
| var Feline = new Cobra.Class({ | |
| __extends__: Animal, | |
| __init__: function(self) { | |
| Cobra.Class.ancestor(Feline, '__init__', self); |
This file contains hidden or 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
| //These vows | |
| var vows = require('vows'), | |
| assert = require('assert'), | |
| sys = require('sys'), | |
| zeromq = require('zeromq'); | |
| vows.describe('ZeroMQ') | |
| .addBatch({ | |
| 'A context': { | |
| topic: function() { this.callback(new zeromq.Context()) }, |
This file contains hidden or 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
| // By just injecting a script tag, we can version the template and exploit the cache | |
| function loadTemplate(template, version) { | |
| var src = '/media/bujagali/' + this.name + '.' + this.version + '.js'; | |
| var headEl = document.getElementByTag('head')[0]; | |
| var script; | |
| script = document.createElement('script'); | |
| script.type = 'text/javascript'; | |
| script.src = src; | |
| headEl.appendChild(script); |