Skip to content

Instantly share code, notes, and snippets.

@amitmbee
amitmbee / html5video.js
Created November 12, 2016 06:31
HTML5 Video function for modals
$("#playbtn").on('click', function() {
var video = document.getElementById(videoid);
video.play()
});
function stopVideo(videoid) {
var video = document.getElementById(videoid);
video.pause();
video.currentTime = 0;
}
@amitmbee
amitmbee / faltu.md
Created December 7, 2016 08:25
F.A.L.T.U

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.

# 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
@amitmbee
amitmbee / debounce.js
Created January 27, 2018 07:08
Debounce.js
// 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;
@amitmbee
amitmbee / poll.js
Created January 27, 2018 07:10
Poll.js
//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!
@amitmbee
amitmbee / once.js
Created January 27, 2018 07:15
Once - Can call a callback(eventHandlers mostly) only once, returns undefined the second time
//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;
@amitmbee
amitmbee / getAbsoluteUrl.js
Created January 27, 2018 07:18
getAbsoluteUrl - get the absolute URL when a string parameter is passed as a argument to the function
//works in browser only
var getAbsoluteUrl = (function() {
var a;
return function(url) {
if(!a) a = document.createElement('a');
a.href = url;
return a.href;
};
@amitmbee
amitmbee / deep-clone.js
Last active January 27, 2018 07:36
[Javascript Object Deep-Cloning methods] #javascript
//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!
@amitmbee
amitmbee / .gitignore
Last active January 27, 2018 07:36
[Global Gitignore] #other
### Node ###
# Logs
logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Optional npm cache directory