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 $ = require('jquery'); | |
// I would assume this would work: | |
var DOMPurify = require('dompurify'); | |
try { | |
var firstHTML = DOMPurify.sanitize('<p onclick="alert(10);">First worked</p>'); | |
$('body').append( firstHTML ); | |
} catch (err) { | |
$('body').append( '<p>' + err + '</p>' ); |
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
// ==================== Existing ========================================= | |
shorten: function(url, callback, reshortenLink) { | |
// ... | |
}, | |
// called | |
Shortener.shorten('site.com/some/url', function(){ | |
// more logic | |
}, true) |
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($){ | |
function inputFocus(){ | |
var input = $(this); | |
if (input.val() === input.attr('placeholder')) { | |
input.val(''); | |
input.removeClass('placeholder'); | |
} | |
} |
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 Levenshtein = require('levenshtein'); | |
var titles = ["15 Twitter Hacks That Will Turn You Into a Twitter Ninja", "The Big List of Twitter Tools: 59 Free Twitter Tools and Apps to Fit Any Need", "Introducing Groups: The Easiest Way to Manage All Your Social Media Accounts With One Click", "What Really Happens When Someone Clicks Your Facebook Like Button"]; | |
var currentTitle = "59 Free Twitter Tools and Apps That Do Pretty Much Everything"; | |
function matchingWordsPercentage(orig, test) { | |
var origWords = orig.toLowerCase().split(' '); | |
var testWords = test.toLowerCase().split(' '); | |
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
// deps: | |
// db.js = shared/libs/db.js | |
buffer.localDatabase = { | |
// Increase this to clear the db entirely | |
dbVersion: 1, | |
open: function() { | |
return db.open({ |
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
/* globals React */ | |
/** @jsx React.DOM */ | |
/** | |
* ReactModal | |
* Create your own React modal within a react component: | |
* render: function() { | |
* return ( | |
* <ReactModal isOpen={this.props.isOpen}> | |
* <ReactModalHeader> |
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
/* globals React */ | |
var Timeline = require('../shared/views/timelineReact.js'); | |
var QueueHeader = require('../shared/views/queueHeader.js'); | |
// buffer.View.CalendarPending | |
var QueueController = module.exports = { | |
_data: { | |
view: 'list' | |
}, |
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 AnalyticsStore = modules.exports = { | |
_data: new Backbone.Collection(), | |
_daysInCache: [], | |
grabDaysForCache: function(data) { | |
var days = data.updates.map(function(update){ | |
return Math.r(update.due_at / 24 / 3600); // days since 1970 | |
}); |
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
'use strict'; | |
// What is ES2015? | |
// !!!!!!!!!!!!!! let, const !!!!!!!!!!!!!!!!!!!!!! | |
const ONE_HOUR = 60 * 60 * 1000; | |
ONE_HOUR = 60 * 60; | |
// Throws error |
OlderNewer