Skip to content

Instantly share code, notes, and snippets.

View DigitalCoder's full-sized avatar

Emmanuel DEILLER DigitalCoder

  • France
View GitHub Profile
@DigitalCoder
DigitalCoder / function_invocation.js
Created April 11, 2017 11:10 — forked from myshov/function_invocation.js
11 Ways to Invoke a Function
console.log(1);
(_ => console.log(2))();
eval('console.log(3);');
console.log.call(null, 4);
console.log.apply(null, [5]);
new Function('console.log(6)')();
Reflect.apply(console.log, null, [7])
Reflect.construct(function(){console.log(8)}, []);
Function.prototype.apply.call(console.log, null, [9]);
Function.prototype.call.call(console.log, null, 10);
@DigitalCoder
DigitalCoder / yahoo_exchange_rates_jsonp.html
Created December 11, 2016 23:00 — forked from henrik/yahoo_exchange_rates_jsonp.html
JavaScript to get currency exchange rates from Yahoo Finance as JSONP. No XHR!
Get exchange rate as JSONP via YQL.
YQL Console: http://developer.yahoo.com/yql/console
Query (USD to SEK): select rate,name from csv where url='http://download.finance.yahoo.com/d/quotes?s=USDSEK%3DX&f=l1n' and columns='rate,name'
Example code:
<script type="text/javascript">
@DigitalCoder
DigitalCoder / CSS Gooey Menu (Version 2).markdown
Created September 2, 2015 15:22
CSS Gooey Menu (Version 2)
CSS3 Spinning Preloader
------
A [Pen](http://codepen.io/DigitalCoder/pen/eNqazr) by [DigitalCoder](http://codepen.io/DigitalCoder) on [CodePen](http://codepen.io/).
[License](http://codepen.io/DigitalCoder/pen/eNqazr/license).
@DigitalCoder
DigitalCoder / LICENSE
Last active August 29, 2015 14:27 — forked from ourmaninamsterdam/LICENSE
Arrayzing - The JavaScript array cheatsheet
The MIT License (MIT)
Copyright (c) 2015 Justin Perry
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
$(document).ready(function () {
// Initialize the PubNub API connection.
var pubnub = PUBNUB.init({
publish_key: 'PUBNUB PUBLISH KEY HERE',
subscribe_key: 'PUBNUB SUBSCRIBE KEY HERE'
});
// Grab references for all of our elements.
var messageContent = $('#messageContent'),
sendMessageButton = $('#sendMessageButton'),
// Avoid `console` errors in browsers that lack a console.
(function() {
var method;
var noop = function () {};
var methods = [
'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
'timeStamp', 'trace', 'warn'
];
@DigitalCoder
DigitalCoder / snippet.js
Last active August 29, 2015 14:07 — forked from necolas/snippet.js
/*
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/
* Better handling of scripts without supplied ids.
*
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function.
*/
(function(doc, script) {
var js,
fjs = doc.getElementsByTagName(script)[0],