Skip to content

Instantly share code, notes, and snippets.

View sanketmaru's full-sized avatar
🎧
Code & Music -- Infinite Loop

Sanket Maru sanketmaru

🎧
Code & Music -- Infinite Loop
View GitHub Profile
@mnsami
mnsami / download_egghead_videos.sh
Last active August 4, 2022 06:27
this script is to download egghead videos using youtube-dl
#!/bin/bash
usage() { echo "usage: --coursename [--coursename \"build-a-react-app-with-redux\"] --type [--type \"courses|lessons\"]" 1>&2; exit 1; }
OPTS=$(getopt -o c:t: --long coursename:,type: -n 'download_egghead_videos.sh' -- "$@")
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
eval set -- "$OPTS"
@sanketmaru
sanketmaru / promise-sync-example.js
Last active July 20, 2016 12:06
promise-sync-example
Promise.map(emailParams,function(emailParam) {
logger.info('sending email to sendmail for %j', emailParam, {});
var host = "www.example.com/";
var html = jadeS.renderFile(template, {
farms: emailParam.farms,
headerImage: "image",
heading: emailParam.heading,
fieldFocusUrl: "someurl",
host: host
});
@jimfb
jimfb / react-refs-must-have-owner.md
Last active July 13, 2019 06:35
addComponentAsRefTo Invariant Violation

You are probably here because you got the following error messages:

addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's render method, or you have multiple copies of React loaded.

This usually means one of two things:

  • You are trying to add a ref to an element that is being created outside of a component's render() function.
  • You have multiple (conflicting) copies of React loaded (eg. due to a miss-configured NPM dependency)

Invalid Refs

@ericelliott
ericelliott / essential-javascript-links.md
Last active May 17, 2024 03:38
Essential JavaScript Links
@addyosmani
addyosmani / composition.md
Last active January 23, 2016 21:39
JS Musings

Composition

On an architectural level, the way we craft large-scale applications in JavaScript has changed in at least one fundamental way in the last four years. Once you remove the minutia of machinery bringing forth data-binding, immutable data-structures and virtual-DOM (all of which are interesting problem spaces) the one key concept that many devs seem to have organically converged on is composition. Composition is incredibly powerful, allowing us to stitch together reusable pieces of functionality to "compose" a larger application. Composition eschews in a mindset of things being good when they're modular, smaller and easier to test. Easier to reason with. Easier to distribute. Heck, just look at how well that works for Node.

Composition is one of the reasons we regularly talk about React "Components", "Ember.Component"s, Angular directives, Polymer elements and of course, straight-up Web Components. We may argue about the frameworks and libraries surrounding t

@yashprit
yashprit / python_webserver.md
Last active August 29, 2015 14:02
Simple Python server on mac

You can open html file in browser, but browser open it with file:///, serving everything from file system is not possible, I mean working with ThreeJS, ploymer you need to run everything on web server. So here is very simple web server using Python on Mac

  1. Go to directory (your development) where you need to serve file using web server
  2. Type python -m SimpleHTTPServer 8000
  3. open in browser http://localhost:8000/<name_of_file>.html

You can see file serving from web server, instead of file:///

@desandro
desandro / require-js-discussion.md
Created January 31, 2013 20:26
Can you help me understand the benefit of require.js?

I'm having trouble understanding the benefit of require.js. Can you help me out? I imagine other developers have a similar interest.

From Require.js - Why AMD:

The AMD format comes from wanting a module format that was better than today's "write a bunch of script tags with implicit dependencies that you have to manually order"

I don't quite understand why this methodology is so bad. The difficult part is that you have to manually order dependencies. But the benefit is that you don't have an additional layer of abstraction.


@aemkei
aemkei / LICENSE.txt
Last active April 12, 2024 21:27 — forked from 140bytes/LICENSE.txt
Binary Tetris - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@mmalecki
mmalecki / nextTick.js
Created October 2, 2011 12:13
process.nextTick vs setTimeout(fn, 0)
for (var i = 0; i < 1024 * 1024; i++) {
process.nextTick(function () { Math.sqrt(i) } )
}