https://adam.merrifield.ca/2016/06/28/passing-arguments-to-a-javascript-callback-function/ https://github.com/FAC7/READMEs http://blog.sourcing.io/interview-questions https://github.com/adam-s/js-interview-review
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
$("#playbtn").on('click', function() { | |
var video = document.getElementById(videoid); | |
video.play() | |
}); | |
function stopVideo(videoid) { | |
var video = document.getElementById(videoid); | |
video.pause(); | |
video.currentTime = 0; | |
} |
Chandler Bing: I loved her. She loved me. She was perfect. Unfortunately, she got fat.
Sherlock: I loved her. She loved me. She was perfect. Unfortunately, love is a chemical defect found in the losing side.
Barney Stinson: I loved her. She loved me. She was perfect. Unfortunately, The sun came up and I decided to be awesome. What up!
Batman: I loved her. She loved me. She was perfect. Unfortunately, She turned out to be Ra’s al Ghul’s daughter.
Jon Snow: I loved her. She loved me. She was perfect. Unfortunately, GRR Martin killed her.
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
# Breaking into Web Development | |
I work as an analyst contractor, these days my roles are often a mixture of development and management. I have been asked by a countless number of people what they need to do to get the jobs I’m offered – and it’s simpler than most expect. The market for talented developers in the United Kingdom (and in many talent-lite communities around the world) is such that anyone who merely knows what they are doing has a very good chance of getting a job. Even a job contracting (which ordinarily has senior-level requirements). | |
To become a web developer with a good salary and employment expectations you need skills. Below I’ll provide a plan to get you towards the top of the largest market: PHP Web Development. Advanced knowledge of everything on this list would immediately make you one of the best, so just strive to have an exposure if not a comprehensive understanding (though the *starred points are essential). To *learn* these technologies you should use several in combination on on |
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
// Returns a function, that, as long as it continues to be invoked, will not | |
// be triggered. The function will be called after it stops being called for | |
// N milliseconds. If `immediate` is passed, trigger the function on the | |
// leading edge, instead of the trailing. | |
function debounce(func, wait, immediate) { | |
var timeout; | |
return function() { | |
var context = this, args = arguments; | |
var later = function() { | |
timeout = null; |
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
//poll | |
//As I mentioned with the debounce function, sometimes you don't get to plug into an event to signify a desired state -- if //the event doesn't exist, you need to check for your desired state at intervals: | |
// The polling function | |
function poll(fn, timeout, interval) { | |
var endTime = Number(new Date()) + (timeout || 2000); | |
interval = interval || 100; | |
var checkCondition = function(resolve, reject) { | |
// If the condition is met, we're done! |
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
//once | |
//There are times when you prefer a given functionality only happen once, similar to the way you'd use an onload event. //This code provides you said functionality: | |
function once(fn, context) { | |
var result; | |
return function() { | |
if(fn) { | |
result = fn.apply(context || this, arguments); | |
fn = null; |
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
//works in browser only | |
var getAbsoluteUrl = (function() { | |
var a; | |
return function(url) { | |
if(!a) a = document.createElement('a'); | |
a.href = url; | |
return a.href; | |
}; |
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
//JSON.parse | |
const obj = /* ... */; | |
const copy = JSON.parse(JSON.stringify(obj)); | |
/*The downside here is that you create a temporary, potentially big string just to pipe it back into a parser. Another downside is that this approach cannot deal with cyclic objects. And despite what you might think, those can happen quite easily. For example when you are building tree-like data structures where a node references its parent, and the parent in turn references its own children.*/ | |
const x = {}; | |
const y = {x}; | |
x.y = y; // Cycle: x.y.x.y.x.y.x.y.x... | |
const copy = JSON.parse(JSON.stringify(x)); // throws! |
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
### Node ### | |
# Logs | |
logs | |
npm-debug.log* | |
yarn-debug.log* | |
yarn-error.log* | |
# Optional npm cache directory |
OlderNewer