Skip to content

Instantly share code, notes, and snippets.

View kevburnsjr's full-sized avatar

Kevin Burns kevburnsjr

View GitHub Profile
@kevburnsjr
kevburnsjr / gist:1067882
Created July 6, 2011 17:56
Changing delimiters breaks partials.
diff --git a/mustache.js b/mustache.js
index 35a8976..eef01f2 100644
--- a/mustache.js
+++ b/mustache.js
@@ -185,8 +185,8 @@ var Mustache = function() {
set_delimiters: function(delimiters) {
var dels = delimiters.split(" ");
- this.otag = this.escape_regex(dels[0]);
- this.ctag = this.escape_regex(dels[1]);
{
"@href": "/todo-list",
"@curies": {
"td": "http://mytodoapp.com/rels/"
},
"@links": {
"td:search": { "@href": "/todo-list/search;{searchterm}" },
"td:description": { "@href": "/todo-list/description" }
},
"@resources": {
[15:25] <KevBurns> So i have this mustache template which includes a <script type='text/html'> block containing a mustache template that I want to ship to the client.
[15:26] <KevBurns> but all the tags within the block are getting rendered
[15:26] <KevBurns> what's the best way to tell Mustache not to render tags within a block of text?
[15:28] <KevBurns> I tried changing delimiters for the block
[15:28] <KevBurns> {{=<% %>=}} {{stuff_for_client}} <%={{ }}=%>
[15:28] <KevBurns> but it didn't work...
[15:28] <KevBurns> should it have?
[15:30] <KevBurns> hmm... looks like this might be a bug in mustache.php
[15:31] <KevBurns> It would be awesome if there were a special tag for this
[15:32] <KevBurns> {{% {{dont_render_this_tag}} {{or_this_one}} %}}
defiance ~: sudo -i hpacucli
HP Array Configuration Utility CLI 7.70-12.0
Detecting Controllers...Done.
Type "help" for a list of supported commands.
Type "exit" to close the console.
=> ctrl all show config
Smart Array 5i in Slot 0 ()
### Class
class Mustache_View implements Zend_View_Interface {
protected $_mustache;
protected $_data;
function render($file) {
$this->_data['_nicedate'] = function($timestamp) {
return str_replace("T"," ",$timestamp);
};
mantle ~/riak_search/rel/riaksearch: l data/merge_index/
total 264
drwxr-xr-x 66 root root 4096 2011-03-13 13:10 .
drwxr-xr-x 6 root root 4096 2011-03-13 13:10 ..
drwxr-xr-x 2 root root 4096 2011-03-13 13:10 0
drwxr-xr-x 2 root root 4096 2011-03-13 13:10 1004782375664995756265033322492444576013453623296
drwxr-xr-x 2 root root 4096 2011-03-13 13:10 1027618338748291114361965898003636498195577569280
drwxr-xr-x 2 root root 4096 2011-03-13 13:10 1050454301831586472458898473514828420377701515264
drwxr-xr-x 2 root root 4096 2011-03-13 13:10 1073290264914881830555831049026020342559825461248
drwxr-xr-x 2 root root 4096 2011-03-13 13:10 1096126227998177188652763624537212264741949407232
Riak
Flexible, Decentralized, Homogenous, Resilient
Overview
http://blip.tv/file/2861346
Yammer case study
http://vimeo.com/21598799
@kevburnsjr
kevburnsjr / count_pubmed.json
Created April 3, 2011 17:22
map/reduce query to count pubmed articles
{
"inputs": "pubmed_articles",
"query":[
{"map":{"language":"erlang","module":"z_pubmed","function":"count_map"}},
{"reduce":{"language":"erlang","module":"z_pubmed","function":"count_reduce"}}
]
}
@kevburnsjr
kevburnsjr / z_pubmed.erl
Created April 3, 2011 17:21
pubmed mapreduce functions
-module(z_pubmed).
-export([count_map/3, count_reduce/2]).
count_map(Value, _KeyData, _Arg) ->
[1].
count_reduce(List, _Arg) ->
[lists:foldl(fun erlang:'+'/2, 0, List)].
@kevburnsjr
kevburnsjr / gist:827067
Created February 15, 2011 03:52
streamKeys
<?php
/**
* Retrieve a list of keys in this this bucket as a stream segment
* @param integer $offset - Starting key offset.
* @param integer $limit - Maximum number of keys to return.
* @return array() of keys
*/
function streamKeys($offset=0, $limit=100) {
$params = array('props' => 'false', 'keys' => 'stream');