Skip to content

Instantly share code, notes, and snippets.

View nmabhinandan's full-sized avatar
🏠
Working from home

Abhinandan nmabhinandan

🏠
Working from home
View GitHub Profile
@doug
doug / webcomponets.html
Created December 8, 2014 00:26
conditionally load webcomponents
<!-- Conditionally load WC polyfills -->
<script>
if ('registerElement' in document
&& 'createShadowRoot' in HTMLElement.prototype
&& 'import' in document.createElement('link')
&& 'content' in document.createElement('template')) {
// We're using a browser with native WC support!
} else {
document.write('<script src="/bower_components/webcomponentsjs/webcomponents.js"><\/script>');
}
@staltz
staltz / introrx.md
Last active May 3, 2024 13:00
The introduction to Reactive Programming you've been missing
@compact
compact / dropzone-directive.js
Last active March 16, 2024 02:55
AngularJS directive for Dropzone.js
/**
* An AngularJS directive for Dropzone.js, http://www.dropzonejs.com/
*
* Usage:
*
* <div ng-app="app" ng-controller="SomeCtrl">
* <button dropzone="dropzoneConfig">
* Drag and drop files here or click to upload
* </button>
* </div>
@boazsender
boazsender / keyboard-event-trigger.js
Created October 17, 2011 03:25
Dispatch a keyboard
/*
Chrome does not let you modify the keyCode prop when you trigger it, so it defaults to 0.
You can use this code to trigger a keydown with a char code of 0 in chrome.
If you use initKeyEvent instead of initKeyboardEvent, it will work in FF
(the bellow example would trigger keydown with a char code of 65 in FF).
*/
document.addEventListener( 'keydown', function( event ){
console.log( event.keyCode )