Cheat sheet extracted from https://www.youtube.com/watch?v=2zmUSoVMyRU by That JS Dude.
If you pass any of the CSS selectors to $(<identifier>)
you get the first element.
> $('a')
angular.module('uiElements', []).directive('ikiLadda', [function () { | |
if (typeof Ladda === 'undefined') { | |
throw new Error('Ladda Library Missing'); | |
// Ladda also depends on Spinner and it will throw error if that library is not present. | |
} | |
return { |
Cheat sheet extracted from https://www.youtube.com/watch?v=2zmUSoVMyRU by That JS Dude.
If you pass any of the CSS selectors to $(<identifier>)
you get the first element.
> $('a')
window.ikiThemes.Utils = (function ($) { | |
return { | |
//http://nodejs.org/docs/latest/api/util.html#util_util_inherits_constructor_superconstructor | |
inherits: function inherits(ctor, superCtor) { | |
ctor.super_ = superCtor; | |
ctor.prototype = Object.create(superCtor.prototype); | |
}, | |
inheritsOLOO: function (superCtor) { | |
var o = Object.create(superCtor); |
/* | |
* From css-tricks.com | |
* http://css-tricks.com/snippets/css/media-queries-for-standard-devices/ | |
*/ | |
/* Smartphones (portrait and landscape) ----------- */ | |
@media only screen | |
and (min-device-width : 320px) | |
and (max-device-width : 480px) { | |
/* Styles */ |
li.iki-spotlight.project.audio[data-sort-date="datum" data-sort-time="vreme"]*10>(div.thumb-wrapper>div.img-wrapper>img.thumb-cover[src=http://hhhhold.com/200x200?r=$]^(div.hover-ui>a.project-link>a.icon-link^a.lightbox-link[href=images/gridthumbs/gridlock_$.jpg]>i.icon-eye)+div.hover-title>a>h6{ Audio Title $})+div.desc-wrapper.row.project-info>div.info-panel.large-12.columns>header>h6{ Title audio $}+p>lorem50 |
<?php | |
/* | |
Plugin Name: Instrument Hooks for WordPress | |
Description: Instruments Hooks for a Page. Outputs during the Shutdown Hook. | |
Version: 0.1 | |
Author: Mike Schinkel | |
Author URI: http://mikeschinkel.com | |
*/ | |
if (isset($_GET['instrument']) && $_GET['instrument']=='hooks') { |
add_action('after_setup_theme','theme_setup'); | |
function theme_setup() | |
{ | |
add_theme_support('prefix-someCPT'); | |
} |
var myFunc = function (param) { | |
if (!myFunc.cache[param]) { | |
var result = {}; | |
// ... expensive operation ... | |
myFunc.cache[param] = result; | |
} | |
return myFunc.cache[param]; | |
}; | |
// cache storage | |
myFunc.cache = {} |
// this is a function expression, | |
// pased as an argument to the function `callMe` | |
callMe(function () { | |
// I am an unnamed function expression | |
// also known as an anonymous function | |
}); | |
Background | 59 | |
// this is a named function expression | |
callMe(function me() { | |
// I am a named function expression |
/ antipattern | |
// for illustration only | |
// global functions | |
function foo() { | |
alert('global foo'); | |
} | |
function bar() { | |
alert('global bar'); | |
} | |
function hoistMe() { |