"Do you know JavaScript?"
"Uhh, yes."
"Do you know Object-orientated JavaScript?"
"Yes."
| jQuery.throwOnStyle = (function($) { | |
| var watchers = []; | |
| $.style = (function(_style) { | |
| return function(elem, name, value) { | |
| for (var i = 0, l = watchers.length; i < l; ++i) { | |
| var w = watchers[i]; | |
| if ( | |
| (w.styleMatcher.test ? |
| 'use strict'; | |
| var CLIENT_ID = 'CLIENT ID'; | |
| var API_KEY = 'YOUR SECRET API KEY (Test or Live)'; | |
| var TOKEN_URI = 'https://connect.stripe.com/oauth/token'; | |
| var AUTHORIZE_URI = 'https://connect.stripe.com/oauth/authorize'; | |
| var qs = require('querystring'); | |
| var request = require('request'); |
| jQuery.fn.genSelector = function() { | |
| // Generate a selector for the given elements | |
| // Note: Selector is not guarenteed to be unique | |
| return this.map(function() { | |
| var out = [], p = this; | |
| switch (true) { | |
| case this.id: return '#' + this.id; | |
| case this === document.body: return 'body'; | |
| case this === document.documentElement: return 'html'; | |
| } |
| function isItFriday() { | |
| return new Date().getDay() === 5 ? | |
| 'It is!' : | |
| 'It is not.'; | |
| } | |
| function whenWillItBeFriday() { | |
| var d = 5 - new Date().getDay(); | |
| return d === 0 ? | |
| 'Right now!' : |
| /** | |
| * Outputs a new function with interpolated object property values. | |
| * Use like so: | |
| * var fn = makeInterpolator('some/url/{param1}/{param2}'); | |
| * fn({ param1: 123, param2: 456 }); // => 'some/url/123/456' | |
| */ | |
| var makeInterpolator = (function() { | |
| var rc = { | |
| '\n': '\\n', '\"': '\\\"', | |
| '\u2028': '\\u2028', '\u2029': '\\u2029' |
"Do you know JavaScript?"
"Uhh, yes."
"Do you know Object-orientated JavaScript?"
"Yes."
| (function() { | |
| var all = document.querySelectorAll('link[rel=stylesheet]'); | |
| var i = setInterval(function() { | |
| for (var l = all.length; l--;) { | |
| var href = all[l].href; | |
| href = href.replace(/[&\?]__reloader__=\d+/, ''); | |
| href += (href.indexOf('?') > -1 ? '&' : '?') + '__reloader__=' + +new Date; | |
| all[l].href = href; |
Write a function f(a, b) which takes two strings as arguments and returns a string containing only the characters found in both strings, in the order that they appeared in a.
Original implementation found here: https://github.com/blakeembrey/code-problems/blob/master/common-string-filter/index.js
| $(window).load(function() { | |
| var h = $('#header'); | |
| setInterval(function() { | |
| var d = new Date; | |
| h.css('backgroundColor', 'hsl('+(0| (d.getSeconds()*1000 + d.getMilliseconds()) / 60000 * 360)+',100%,50%)'); | |
| }, 100); | |
| }); |
| /x/==x |