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
<div id="buttonbar"><img id="memoryToggle" onClick="memoryMode()" class="buttonBar" src="http://www.instaspanish.com/dev/memory.svg" height="75px" width="150px" /><img id="matchToggle" class="buttonBar" onClick="matchMode()" src="http://www.instaspanish.com/dev/match.svg" height="75px" width="150px" /></div> |
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
// db.js (just the User model) | |
var UserSchema = new Schema({ | |
// _id: String, | |
username: String, | |
name: String, | |
gravatar: String, | |
email: String, | |
provider: String, | |
services: String, |
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
/** | |
* User: rupin_t | |
* Date: 6/27/13 | |
* Time: 5:42 PM | |
*/ | |
/** | |
* Custom the template loading. | |
* Each template is downloaded from the server and the cached. | |
* @param templateId |
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
// Changes XML to JSON | |
function xmlToJson(xml) { | |
// Create the return object | |
var obj = {}; | |
if (xml.nodeType == 1) { // element | |
// do attributes | |
if (xml.attributes.length > 0) { | |
obj["@attributes"] = {}; |
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
$.ajax({ url: "info.md", context: document.body, success: function(mdText){ //where text will be the text returned by the ajax call var converter = new Showdown.converter(); var htmlText = converter.makeHtml(mdText); $(".outputDiv").append(htmlText); //append this to a div with class outputDiv } }); |
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 AmericasNextTopModel = Backbone.Models.extend({ | |
initialize: function(){ | |
this.set({ | |
clefs: new ClefCollection(this.get('clefs')), | |
accidentals: new AccidentalCollection(this.get('accidentals')), | |
notes: new NoteCollection(this.get('notes')), | |
rests: new RestCollection(this.get('rests')) | |
}); | |
} |
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 regex = /(<\w+[^<]*?)\s+([\w-]+)="([^"]+)">/; | |
while(xml.match(regex)) xml = xml.replace(regex, '<$2>$3</$2>$1>'); // For attributes | |
xml = xml.replace(/\s/g, ' '). // Finds all the white space converts to single space | |
replace(/< *\?[^>]*?\? *>/g, ''). //Finds the XML header and removes it | |
replace(/< *!--[^>]*?-- *>/g, ''). //Finds and removes all comments | |
replace(/< *(\/?) *(\w[\w-]+\b):(\w[\w-]+\b)/g, '<$1$2_$3'). | |
replace(/< *(\w[\w-]+\b)([^>]*?)\/ *>/g, '< $1$2>'). | |
replace(/(\w[\w-]+\b):(\w[\w-]+\b) *= *"([^>]*?)"/g, '$1_$2="$3"'). | |
replace(/< *(\w[\w-]+\b)((?: *\w[\w-]+ *= *" *[^"]*?")+ *)>( *[^< ]*?\b.*?)< *\/ *\1 *>/g, '< $1$2 value="$3">'). |
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
<!-- | |
Wrote a blog post about how it all works: | |
http://andymcfee.com/2012/08/24/css3-flip-cards/ | |
--> | |
<div class="viewport"> | |
<div class="flip-card"> | |
<div class="card-front"> | |
Front! |
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
jQuery(function() { | |
// Create our namespace and related organizers | |
window.DartsLeague = {}; | |
DartsLeague.Models = {}; | |
DartsLeague.Collections = {}; | |
DartsLeague.Views = {}; | |
DartsLeague.TourneysApp = new Backbone.Marionette.Application({}); | |
/******************************************** |
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
/* | |
Backbone is great for when your application fits the mold it provides. But don't be afraid to go around it when it makes sense for your application. It's a very small library. Making repetitive and duplicate GET requests just to fit backbone's mold is probably prohibitively inefficient. Check out jQuery.getJSON or your favorite basic AJAX library, paired with some basic metaprogramming as following: | |
*/ | |
//Put your real collection constructors here. Just examples. | |
var collections = { | |
Languages: Backbone.Collection.extend(), | |
ProductTypes: Backbone.Collection.extend(), | |
Menus: Backbone.Collection.extend() | |
}; |
OlderNewer