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 Copy-ItemWithPath { | |
param( | |
[Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] | |
[Alias("FullName")] | |
[string[]]$item, | |
[Parameter(Mandatory=$true, Position=1)] | |
[string]$destination, | |
[Parameter(Mandatory=$true, Position=2)] | |
[string]$root | |
) |
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
<# | |
.EXAMPLE | |
Get the "Batch File Download" address for the (Hyper-V) VM of your choice from https://modern.ie/en-gb/virtualization-tools#downloads | |
PS> $source = "https://az412801.vo.msecnd.net/vhd/VMBuild_20141027/HyperV_2012/IE11/Windows/IE11.Win7.For.Windows.HyperV_2012.txt" | |
PS> $destination = (mkdir "$env:USERPROFILE\downloads\vms" -Force) # or use default | |
PS> Install-IEVM $source $destination -import # Will import to default locations | |
#> | |
Function Install-IEVM { | |
param( | |
[Parameter(Mandatory=$true)] |
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
$feedStub = "http://www.myget.org/F/{0}/api/v2/FindPackagesById()?Id='{1}'" | |
$package = "Microsoft.Framework.Runtime.Roslyn" | |
$feeds = @("aspnetmaster", "aspnetvnext") | |
$feeds | % { Invoke-RestMethod -uri ($feedStub -f $_, $package) } | select -ExpandProperty properties | select version | |
<# | |
Output | |
Version | |
------- |
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 email = "user@example.com"; | |
var password = "password"; | |
var repo = SharpnoteRepository<Note>.Instance; | |
if (repo.Connect(email, password)) | |
{ | |
repo.GetIndex() | |
.OrderBy(rn => rn.Modified) | |
.ToList() | |
.ForEach(rn => Console.WriteLine(rn.Modified.ToString())); |
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 email = "user@example.com"; | |
var password = "password"; | |
var repo = SharpnoteRepository<Note>.Instance; | |
if (repo.Connect(email, password)) | |
{ | |
//Create a new note | |
//Notes must have content to be saved | |
var note = new Note | |
{ |
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 arr = [0, 1, 2, 3, null, undefined, '', "test"]; | |
/* Remove 'falsy' values */ | |
//using the filter method available in Javascript 1.6 | |
var output = arr.filter(function(x){return !!x}); | |
console.log(output)// [1, 2, 3, "test"] | |
//using jQuery grep function | |
var jqOutput = $.grep(arr, function(x){return !!x}); | |
console.log(jqOutput )// [1, 2, 3, "test"] |
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
#! /bin/bash | |
### ### | |
# This script assumes you're kicking things off from a clean install of Ubuntu # | |
# You're welcome to skip parts which you've already installed! # | |
### ### | |
# Required - install curl | |
sudo apt-get install curl |
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
/* | |
Define a Settings model object | |
Properties are defined with getters and setters against the setting object itself. | |
*/ | |
var settings = { | |
implement: function(){ | |
var args = Array.prototype.slice.call(arguments); //take any number of arguments | |
args.forEach(function(name){ | |
if(!this.hasOwnProperty(name)){ //only implement properties not already defined | |
Object.defineProperty(this, name, { |
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 sites = Retriever.GetSites(new UserOptions{ Email = "email", Password = "password" }); | |
if (sites != null) | |
{ | |
var primarySite = sites.Single(s => s.IsPrimary); | |
//get posts | |
var posts = Retriever.GetPosts(new PostOptions{SiteId = primarySite.Id, MaxPosts = 50}); | |
//get tags | |
var tags = Retriever.GetTags(new TagOptions { SiteId = primarySite.Id }); | |
} |
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
<script type="text/javascript"> | |
function checkboxlimit(checkgroup, limit){ | |
var checkgroup=checkgroup | |
var limit=limit | |
for (var i=0; i<checkgroup.length; i++){ | |
checkgroup[i].onclick=function(){ | |
var checkedcount=0 | |
for (var i=0; i<checkgroup.length; i++) | |
checkedcount+=(checkgroup[i].checked)? 1 : 0 | |
if (checkedcount>limit){ |
OlderNewer