This file contains hidden or 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
/* | |
Self invoking anonymous function assigned to the yournamespacechoice global variable. Serves the effect of keeping all functions and variables private to this function. To expose a function or variable we must explictly return it at the bottom of the function. Remaps jQuery to $. | |
*/ | |
var yournamespacechoice = (function ($) { | |
var publicfunction; | |
function privatefunction() { | |
// function only available within parent function | |
} |
This file contains hidden or 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
dynamic expando = new ExpandoObject(); | |
expando.Address = new ExpandoObject(); | |
expando.Address.State = "WA"; | |
Console.WriteLine(expando.Address.State); |
This file contains hidden or 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($){ | |
$.fn.extend({ | |
pluginname: function(options) { | |
this.defaultOptions = {}; | |
var settings = $.extend({}, this.defaultOptions, options); | |
return this.each(function() { | |
var $this = $(this); | |
}); |
This file contains hidden or 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 the (Question) ? Positive Answer : Negative Answer patterns the above can be rewritten as: | |
int x = 10; | |
int y = 20; | |
int max = (x > y) ? x : y; |
This file contains hidden or 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
TourHostCompanyProv.Text = NullCheck(reader, "fldTourHostCompanyProv"); | |
public string NullCheck(SqlDataReader reader, string key) | |
{ | |
return (reader[key] == DBNull.Value) ? String.Empty : (string)reader[key]; | |
} |
This file contains hidden or 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
SELECT DISTINCT TOP 1 * FROM Customers WHERE CustomerGUID = 'a3a3' ORDER BY CreatedAt DESC |
This file contains hidden or 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
DELETE a,b,c | |
FROM wp_posts a | |
LEFT JOIN wp_term_relationships b ON ( a.ID = b.object_id) | |
LEFT JOIN wp_postmeta c ON ( a.ID = c.post_id ) | |
LEFT JOIN wp_term_taxonomy d ON ( b.term_taxonomy_id = d.term_taxonomy_id) |
This file contains hidden or 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
//Self-Executing Anonymous Func: Part 2 (Public & Private) | |
(function( skillet, $, undefined ) { | |
//Private Property | |
var isHot = true; | |
//Public Property | |
skillet.ingredient = "Bacon Strips"; | |
//Public Method | |
skillet.fry = function() { |
This file contains hidden or 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
// strongly-typed textbox helper (not the @ because "class" is a keyword... sneaky) | |
@Html.TextBoxFor(model => model.Title, new { @class = "span4" }) | |
// strongly typed validation message | |
@Html.ValidationMessageFor(model => model.Title) |
This file contains hidden or 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
private function newRange( value:Number, oldMin:Number, oldMax:Number, newMin:Number, newMax:Number):Number | |
{ | |
value -= oldMin; | |
value /= (oldMax - oldMin); //returns a value between 0 and 1 | |
return value * (newMax - newMin) + newMin; //place that ratio from previous step into a new range function | |
} |