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
class GadgetController : Controller { | |
// Each MVC controller has a complementing '*ControllerContext' class. | |
private readonly IGadgetControllerContext _context; | |
GadgetController() | |
: this(new GadgetControllerContext()) { } | |
// Unit testing ctor. Allows passing in mock repositories. | |
GadgetController(IGadgetControllerContext context) { | |
_context = context; |
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
package main | |
import ( | |
"bufio" | |
"fmt" | |
"os" | |
"time" | |
) | |
const numWorkers = 3 |
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 rightWay(obj) { | |
for (var key in obj) { | |
// Ignore properties that are inherited. | |
if (!obj.hasOwnProperty(key)) { | |
continue; | |
} | |
console.log(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
<!-- http://cssdesk.com/xnKDc --> | |
<div class="wrap"> | |
<div class="r"><div class="c"><div>1</div></div><div class="c"><div>2</div></div><div class="c"><div>3</div></div><div class="c"><div>4</div></div></div> | |
<div class="r"><div class="c"><div>5</div></div><div class="c"><div>6</div></div><div class="c"><div>7</div></div><div class="c"><div>8</div></div></div> | |
<div class="r"><div class="c"><div>9</div></div><div class="c"><div>10</div></div><div class="c"><div>11</div></div><div class="c"><div>12</div></div></div> | |
<div class="r"><div class="c"><div>13</div></div><div class="c"><div>14</div></div><div class="c"><div>15</div></div><div class="c"><div>16</div></div></div> | |
</div> |
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
<asp:LinkButton ID="btnSave" OnClientClick="return prepareForSave(this);" OnClick="btnSave_Click" runat="server" Text="Save" /> |
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
/// <summary> | |
/// SQL results like this: | |
/// StateId Name Cities_CityId Cities_Name Counties_CountyId Counties_Name | |
/// | |
/// Would be grouped into a distinct list of States. | |
/// If the State object had collection properties for Cities and Counties | |
/// then they would be populated appropriately. | |
/// | |
/// Only supports a single level of collection. That is you can't have Cities_Residents_Name returned | |
/// and expect it to populate a State.Cities.Residents collection. Instead it would be ignored, |
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 System; | |
using System.Diagnostics; | |
using System.Web; | |
using System.Web.Routing; | |
using YourApp.Infrastructure.Framework; | |
namespace YourApp.Web.UI | |
{ | |
public class RestfulRouteModule : IHttpModule | |
{ |
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
#!/usr/bin/perl | |
my $dev = "/sys/class/leds/led0/brightness"; | |
my $OFF = "1"; | |
my $ON = "0"; | |
my ($ip) = `ifconfig`=~/ddr:(.*?) /; | |
#print $ip; | |
# Strip out the .'s | |
$ip =~ s/\.//g; |
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 New-Symlink { | |
<# | |
.SYNOPSIS | |
Creates a symbolic link. | |
#> | |
param ( | |
[Parameter(Position=0, Mandatory=$true)] | |
[string] $Link, | |
[Parameter(Position=1, Mandatory=$true)] | |
[string] $Target |