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
$scope.shortenInText = function () { | |
var text = $scope.content.text || ''; | |
var PROTO_PTRN = /^https?:\/\//; | |
var tokens = text.split(/\s/); | |
_.chain(tokens) | |
// get tokens that look like URLs | |
.map(function(token) { | |
if(PROTO_PTRN.test(token)) { | |
return token; |
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
canvas.scrollStream.takeWhile(function () { | |
console.log('streamEvent'); | |
return canvas.percentVisible() < VISIBILITY_THRESHOLD; | |
}).observe(function () {}).then(function () { | |
console.log('Became visible'); | |
triggerVisibiliyAnalytics(); | |
}); |
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
function imageUploadController(app, logger) { | |
var adminImages = express.Router(); | |
adminImages.use(administrator); | |
app.use('/adminImagesOrSomething', adminImages); | |
adminImages.get('/', function (req. resp) { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Test Programmatic Dijit Layout</title> | |
<meta name="viewport" content="width=570"> | |
<style> | |
@import "../../dijit/themes/claro/document.css"; | |
@import "../../dijit/themes/claro/claro.css"; | |
@import "../css/skins/claro.css"; |
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
define(function () { | |
'use strict'; | |
var LocationManager = require('modules/spxcontroller/LocationManager'); | |
var WindowManager = require('modules/spxcontroller/WindowManager'); | |
var SlinkAnchorService = require('modules/spxcontroller/SlinkAnchorService'); | |
var PresentationService = require('modules/spxcontroller/PresentationService'); | |
var g = require('utils/globalObject'); | |
var utils = require('utils/utils'); |
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
//Gets a jquery object containing all of the elements on the page that have a css class of "show-example1" | |
var showDescriptionInput = $('.show-example1'); | |
//when someone clicks on an element with the id of "name" or "phone" run this function. I think "click.toggle" | |
//is a mistake it should be just click | |
$("#name, #phone").bind('click.toggle', function(e) { | |
//dont do the default HTML thing. SO if this is a link dont make the browser load the new page. | |
e.preventDefault(); |
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
/* | |
This is the build config for my main JS file. | |
*/ | |
({ | |
baseUrl: "src/", | |
//wrap will wrap the entire script in an IIFE which will create private define/require functions | |
wrap: true, | |
out: 'dist/spxmain.js', | |
modules: [{ | |
name: 'requireLib', |
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 when = require('when'); | |
var meld = require('meld'); | |
var winston = require('winston'); | |
var config = require('./config'); | |
var dbAspects = { | |
introDeferred: function(obj,name) { | |
meld.around(obj, name, function(joinpoint) { | |
var def = when.defer(); | |
var promise = def.promise; |
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
loadCss: function( cssString, $head) { | |
var $css = $('<style type="text/css">'+cssString+'<style>'); | |
$head = $head || $('head'); | |
$head.append($css); | |
return $css; | |
} |
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
//Incorrect | |
jQuery(document).ready(function () { | |
var script = document.createElement("script"); | |
script.type = "text/javascript"; | |
script.src = "http://ardrone.swoop.com/js/spxw.js"; // use this for linked script | |
//The following will not properly set the required data attributes properly | |
script.attributes['data-domain'] = 'SW-XXXXXX-X'; | |
script.attributes['data-theme'] = 'red'; | |
script.attributes['data-serverbase']= 'http://ardrone.swoop.com/'; |
NewerOlder