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 my_decorator(klass): | |
old_run = klass.run | |
def wrapper(): | |
def new_run(self, *args, **kwdargs): | |
old_run(self, *args, **kwdargs) | |
print "wrapped" |
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 qs = require("querystring"), | |
xml2js = require("xml2js"), | |
parser = new xml2js.Parser(), | |
config = require("../config"), | |
crypto = require("crypto"), | |
tar = require("tar"), | |
fs = require("fs"); | |
var parseBody = function(body, callback) { | |
var decodedBody = decodeURIComponent(qs.stringify(qs.parse(body))); |
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
Bot.prototype.initialize = function (){ | |
//yadayada whatever else you need | |
this.queueWorking = false; | |
this.queue = []; | |
this.connection.on('data', function (chunk){self.onData(chunk);}); | |
this.on('new message', function (){self.onNewMessage();}); | |
} |
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
import multiprocessing as mp | |
import sys | |
import time | |
def task(say): | |
time.sleep(5) | |
return "Hello, {0}".format(say) | |
def run_pool(): | |
pool = mp.Pool() |
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
emitter = EventEmitter() | |
emitter.on('something', handler_function_1); | |
emitter.on('something', handler_function_2); | |
emitter.on('something_else', handler_function_3); | |
# somewhere else | |
emitter.emit('something'); #handler_function_1 and handler_function_2 are called in order |
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
underscore@1.2.4 /usr/local/lib/node_modules/couchtato/node_modules/nomnom/node_modules/underscore | |
underscore@1.2.4 /usr/local/lib/node_modules/underscore | |
request@2.9.3 /usr/local/lib/node_modules/couchapp/node_modules/request | |
semver@1.0.13 /usr/local/lib/node_modules/npm/node_modules/semver | |
rimraf@1.0.9 /usr/local/lib/node_modules/npm/node_modules/rimraf | |
npm ERR! error installing forever@0.8.1 Error: EACCES, permission denied '/usr/local/lib/node_modules/forever/README.md' | |
npm ERR! error rolling back forever@0.8.1 Error: EACCES, permission denied '/usr/local/lib/node_modules/forever/LICENSE' | |
npm ERR! Error: EACCES, permission denied '/usr/local/lib/node_modules/forever/README.md' | |
npm ERR! Report this *entire* log at: | |
npm ERR! <http://github.com/isaacs/npm/issues> |
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
<script type="text/x-handlebars" data-template-name="blog-post"> | |
{{view Blog.EditFormView contentBinding="content" classBinding="content.isEditing:editing-form"}} | |
{{view Blog.PostDisplayView contentBinding="content" classBinding="content.isEditing:editing-display"}} | |
{{#if showComments}} | |
<div id="disqus_thread"></div> | |
{{#view contentBinding="content" tagName="script" type="text/javascript"}} | |
var disqus_shortname = 'ideafreemonoid'; | |
var disqus_identifier = '{{content.slug}}'; | |
(function() { | |
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; |
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
<script type="text/x-handlebars" data-template-name="blog"> | |
<div class="actions">{{view Blog.AddPostLink}}</div> | |
{{#collection contentBinding="Blog.postsController" tagName="ol" class="posts"}} | |
{{view Blog.BlogPostView contentBinding="content" classBinding="content.isDraft:blog-draft"}} | |
{{/collection}} | |
{{#if hasManyPages}} | |
<div class="pagination"><a href="#!blog/1">«first</a> | |
{{#each pagesLinkData}} | |
<a href="{{pageHref}}">{{page}}</a> | |
{{/each}} |
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
Blog.BlogView = Ember.View.extend({ | |
templateName: "blog" | |
, currentPageBinding: "Blog.postsController.currentPage" | |
, totalPagesBinding: "Blog.postsController.totalPages" | |
, hasManyPages: function (){ | |
return this.get("totalPages") > 1; | |
}.property("totalPages") | |
, pagesLinkData: function (){ |
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
App.MyView1 = Ember.View.extend({ | |
templateName: 'mytemplate' | |
}); | |
App.MyView2 = App.MyView1.extend({}); | |