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 recipeList = new ListView({ | |
| title: 'Recipes', | |
| dataProvider: recipes, | |
| display: '{name} - {difficulty}', | |
| onItemSelect: function(item) { | |
| } | |
| }); | |
| panel.grab(recipeList); |
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 A = new Class({ | |
| initialize: $empty, | |
| a: function() { | |
| return arguments.callee.caller.caller.caller._name; | |
| }, | |
| b: function() { | |
| console.log(this.a()); //knows 'b' called it | |
| } | |
| }); |
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
| function range(min, max) { | |
| if(!max) { | |
| max = min; | |
| min = 0; | |
| } | |
| var arr = []; | |
| for(var i = min; i <= max; i++) { | |
| arr.push(i); | |
| } | |
| return arr; |
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
| Function.prototype.lazy = function() { | |
| var fn = this, | |
| init = false; | |
| return function() { | |
| if(!init) { | |
| init = true; | |
| fn = fn.apply(this, arguments); | |
| } | |
| return fn.apply(this, arguments); | |
| } |
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
| <label> | |
| <span>Always switch:</span> | |
| <input type="checkbox" name="change" id="change" /> | |
| </label> | |
| <button type="button" id="btn">Loop</button> |
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
| Array.implement('batch', function(callback, loopsPerBatch, delay, bind) { | |
| if(!loopsPerBatch) loopsPerBatch = 10; | |
| if(!delay) delay = 50; | |
| if(callback) { | |
| var loops = 0, | |
| index = 0, | |
| that = this; | |
| function doLoops() { | |
| loops = 0; | |
| for (var length = that.length; (index < length) && loops < loopsPerBatch; index++) { |
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
| #!/usr/bin/env python | |
| import os | |
| import sys | |
| import urllib2 | |
| from xml.dom import minidom | |
| from datetime import datetime | |
| def url_request(url): | |
| text = None |
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
| Collapse.Stateful = new Class({ | |
| // or perhaps Collapse.Persistant? | |
| Extends: Collapse, | |
| options: { | |
| getAttribute: function(element){ | |
| return element.get('id'); | |
| }, |
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 extend = function(child, parent) { | |
| for(var i in parent) { | |
| if(parent.hasOwnProperty(i)) { | |
| child[i] = parent[i]; | |
| } | |
| } | |
| return child; | |
| }; |
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
| class QuerySetManager(models.Manager): | |
| def get_query_set(self): | |
| return self.QuerySet(self.model) | |
| def __getattr__(self, attr, *args): | |
| return getattr(self.get_query_set(), attr, *args) |
OlderNewer