Moved to a dedicated repository: https://github.com/softwarespot/PubSub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Append an option element to a select element | |
var $input = $('select'); | |
$('<option/>') | |
.prop('value', value) | |
.html(value) | |
.appendTo($input); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var undefined = 'Undefined is now a string'; | |
// Immediately-Invoked Function Expression (IIFE) | |
(function (undefined) { | |
console.log('Local undefined is: ' + (typeof undefined)); | |
})(); // Don't pass anything, so undefined locally will be truly undefined | |
console.log('Global undefined: ' + (typeof undefined)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Squirrel.js form demo</title> | |
<!--Mobile Specific Metas--> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
</head> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* jQuery Tiny Pub/Sub - v0.1 - 2015/08/07 | |
* http://benalman.com/ | |
* | |
* Original Copyright (c) 2010 'Cowboy' Ben Alman | |
* Dual licensed under the MIT and GPL licenses. | |
* http://benalman.com/about/license/ | |
* | |
* Made awesome by Rick Waldron, with additional ideas by Jeffrey Way and softwarespot | |
* URL: https://gist.github.com/rwaldron/705311 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// jQuery source outlines differences | |
const items = [1, 2, 3, 4, 5]; | |
// MAP | |
// $.map() returns a new array | |
const array = $.map(items, function (item, index) { // item first then index | |
console.log(item); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place your settings in this file to overwrite the default settings | |
{ | |
// Controls the font family. | |
"editor.fontFamily": "Source Code Pro", | |
// When enabled, will trim trailing whitespace when you save a file. | |
"files.trimTrailingWhitespace": true, | |
// Don't spare curly brackets. | |
"javascript.validate.lint.curlyBracketsMustNotBeOmitted": "error", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var EventsUtility = { | |
addEvent: function (element, type, callback) { | |
if (typeof addEventListener !== 'undefined') { | |
element.addEventListener(type, callback, false); | |
} else if (typeof attachEvent !== 'undefined') { | |
element.attachEvent('on' + type, callback); // IE, legacy browser | |
} else { | |
element['on' + type] = callback; | |
} | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Draggable module | |
* | |
* @link https://gist.github.com/yuanchuan/1330150 | |
* | |
* Modified: 2015/08/12 | |
* @author softwarespot | |
*/ | |
(function draggableModule(document, $) { | |
// Plugin Logic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) { | |
int data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; | |
int i = 0; | |
int max = data[0]; | |
int min = data[0]; | |
// Obtain the size of the array by obtaining the number of bytes of the array divided by the size of the first element |
OlderNewer