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 setThis () { | |
firebaseRef.child('users').child(user.name).set(user); | |
}; | |
data.forEach(function (user) { | |
module.user(user.name, function(err, data){ | |
firebaseRef.child('users').child(user.name).update(user, setThis()); | |
}); | |
}); |
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 API (){ | |
this._apiString = ""; | |
//TODO: add this to check if we already have a param or not, then finish route | |
this.addQueryParam = function (){ | |
// console.log(this._apiString.toString().search("\?")); | |
} | |
this.v = 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
/** | |
* MediaFormat | |
* format and return only needed pieces of media from their public sources | |
* Author: Trevor Clarke | |
*/ | |
function MediaFormat (){ | |
// http://www.youtube.com/embed/m5yCOSHeYn4 | |
var ytRegEx = /^(?:https?:\/\/)?(?:i\.|www\.|img\.)?(?:youtu\.be\/|youtube\.com\/|ytimg\.com\/)(?:embed\/|v\/|vi\/|vi_webp\/|watch\?v=|watch\?.+&v=)((\w|-){11})(?:\S+)?$/; | |
// http://vimeo.com/3116167, https://player.vimeo.com/video/50489180, http://vimeo.com/channels/3116167, http://vimeo.com/channels/staffpicks/113544877 | |
var vmRegEx = /https?:\/\/(?:vimeo\.com\/|player\.vimeo\.com\/)(?:video\/|(?:channels\/staffpicks\/|channels\/)|)((\w|-){7,9})/; |
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
/** | |
* States | |
* A simple value store of states | |
*/ | |
D.value("States", [{ | |
"name": "Alabama", | |
"abbr": "AL" | |
},{ | |
"name": "Alaska", | |
"abbr": "AK" |
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
/** | |
* Module Starter | |
*/ | |
var NS = "ModuleName"; | |
// load the module into global | |
window[NS] = (function(){ | |
/** | |
* Internal - encapsulates all logic | |
* |
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
/** | |
* chromeInstall | |
* a directive for inline install of a chrome extension from a website using Angular | |
* | |
* Make sure that the head meta data contains: | |
* <link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/CHROME_EXTENSION_ID"> | |
*/ | |
yourApp.directive('chromeInstall', | |
[function() { | |
return { |
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
/** | |
* Youtube quick module | |
* | |
* USE: | |
* var _yt = new youtube().init({ | |
* element: "player", | |
* height: 350, | |
* width: 640, | |
* videoId: 'M7lc1UVf-VE' | |
* }); |
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
/** | |
* tbde | |
* AKA "The Best Directive Ever" | |
*/ | |
D.directive('tbde', | |
["$http","$rootScope", function ($http,$rootScope) { | |
return { | |
restrict: 'A', | |
link: function (scope, element, attrs) { | |
var randomGifUrl = "http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&tag=laugh"; |
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
// I wanted to be able to simply change an object with key/search values, so that any array item keys that match also check for those search values | |
// The returned data, is only data that meets all requirements inside of the filterObject | |
// | |
// Example filterObject:{ | |
// names: "Trevor", | |
// countries: "USA" | |
// } | |
// Example Array: [{ | |
// title: "People in USA" | |
// names: ["Trevor", "Steve"] |
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
// Test array | |
var evens = [2,4,6,8,10] | |
// Example Expression | |
var nums = evens.map((v, i) => { | |
// here, "this" becomes undefined. There is no lexical parent to tie to. | |
console.log(this) | |
return v + i | |
}) | |
OlderNewer