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
| // checks screen size | |
| var isMobile = { | |
| any: function() { | |
| return($(window).width()<=599); | |
| // nexus7 width is 600 (window.innerWidth) | |
| // this will not run any reformatting for the phone layout on nexus | |
| } | |
| }; |
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 activeElement = document.activeElement; | |
| if(activeElement){ | |
| activeElement.blur(); | |
| } |
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
| data:text/html,<div class="wrap"> <h1>Todo<span>, no fuss lists</span></h1> <input placeholder="Add a todo" type="text" id="item" /> <button id="go">Save</button> <span class="help">* tap to delete</span> <ul id="tudu_list"> </ul> </div><script type="text/javascript">var tudu_list = document.getElementById('tudu_list'); var item = document.getElementById('item'); var new_li; var new_obj = {}; function prependElement(parentID,child) { parent=parentID; parent.insertBefore(child,parent.childNodes[0]); } function remove(element){ element.parentNode.removeChild(element); } function deleteItem(){ var answer = confirm('Sure you want to remove this?'); if(answer){ var deleteId = this.getAttribute('rel'); remove(this); } } function addItem(){ if(item.value !== ''){ new_li = document.createElement('li'); new_li.innerHTML = item.value; prependElement(tudu_list, new_li); new_li.onclick = deleteItem; item.value = ''; } } function callAdd(e){ if(event.keyCode == 13){ addItem(); } } item.onkeyup = function(e){ callAdd(e) }; |
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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
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 gulp = require('gulp'); | |
| var source = require('vinyl-source-stream'); | |
| var watchify = require('watchify'); | |
| var livereload = require('gulp-livereload'); | |
| var hbsfy = require("hbsfy").configure({ | |
| extensions: ["html"] | |
| }); | |
| gulp.task('watch', function() { |
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
| NSInteger count = [timelineData count]; | |
| for (NSInteger index = (count - 1); index >= 0; index--) { | |
| NSMutableDictionary *tweet = timelineData[index]; | |
| if (tweet[@"retweeted_status"]) { | |
| [timelineData removeObjectAtIndex:index]; | |
| } else { | |
| NSMutableDictionary *userObject = [tweet[@"user"] mutableCopy]; | |
| int fav_count = tweet[@"favorite_count"]; | |
| int rt_count = tweet[@"retweet_count"]; | |
| int follower_count = userObject[@"followers_count"]; |
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
| Had a similar question a few weeks ago, so might as well forward you that! | |
| http://addyosmani.com/resources/essentialjsdesignpatterns/book/ | |
| http://shop.oreilly.com/product/0636920025245.do | |
| http://shop.oreilly.com/product/0636920018421.do | |
| http://shop.oreilly.com/product/9780596806767.do |
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 $ = require('jquery'); | |
| $('body').css('background-color', 'red'); |
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 gulp = require('gulp'); | |
| var source = require('vinyl-source-stream'); | |
| var watchify = require('watchify'); | |
| var livereload = require('gulp-livereload'); | |
| var hbsfy = require("hbsfy").configure({ | |
| extensions: ["html"] | |
| }); | |
| gulp.task('scripts', function() { |
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 Backbone = require('backbone'); | |
| var $ = require('jquery'); | |
| var Handlebars = require('handlebars'); | |
| var HandlebarsHelpers = require('base/utils/template-helpers'); | |
| var templateCache = require('base/utils/template-cache'); | |
| module.exports = Backbone.View.extend({ | |
| initialize: function(options) { | |
| this.templates = templateCache.get(); |