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
// | |
// Adds jQuery Pseudo Selectors for HTML5 input types. | |
// | |
// Example: | |
// HTML: | |
// <input type="email" name="user_email"> | |
// jQuery: | |
// $(':email'); | |
// | |
// |
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
// | |
// For simple selectors, these return a jQuery object | |
// faster via native element selection. | |
// | |
(function(window) { | |
var | |
doc = window.document, | |
$ = window.jQuery; |
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
using System.Data; | |
using System.Data.SqlClient; | |
using System.Text; | |
namespace Gists.Data | |
{ | |
public class Friends | |
{ | |
/// <summary> | |
/// Inserts each friends' name into a table. |
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
// Flag Enumerations in JavaScript | |
// =============================== | |
// Flag enums | |
// ---------- | |
// Values must increment by powers of 2 | |
var SEASONS = { | |
Spring : 1, | |
Summer : 2, |
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
function isInvalidDate( /*Date*/date ) { | |
if (date == null || !(date instanceof Date)) return true; | |
var ts = date.getTime(); | |
if (ts !== ts) return true; // NaN | |
var str = date.toString(); | |
return str === 'Invalid Date' || str === 'NaN'; | |
} |
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
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"net/http" | |
) | |
// Learning Go | |
// First try at serving JSON |
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
public class Person { | |
public string name { get; set; }; | |
public byte age { get; set; }; | |
} |
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
[HttpPost] | |
public ActionResult Create(FormCollection collection) | |
{ | |
var username = collection.Fetch("username", "anonymous"); | |
// username will equal "anonymous" if it was not submitted | |
} | |
// VERSUS: | |
[HttpPost] |
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
/** | |
* Prints an element and its contents. | |
* jQuery free version of Ben Nadel's jQuery plugin. | |
* http://www.bennadel.com/blog/1591-Ask-Ben-Print-Part-Of-A-Web-Page-With-jQuery.htm | |
* | |
* @param {HTMLElement} el | |
* @returns {undefined} | |
*/ | |
function printElement(el) { | |
var csslinks = document.getElementsByTagName('link'); |
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
/** | |
* range(2, 6) // [2,3,4,5,6] | |
* range(5).to(8) // [5,6,7,8] | |
* range(4).until(10) // [4,5,6,7,8,9] | |
*/ | |
var range = function(s, e) { | |
if (e == null) { | |
return { | |
to: function(e) { |
OlderNewer