Skip to content

Instantly share code, notes, and snippets.

Avatar

Robert Swilley rswilley

View GitHub Profile
@rswilley
rswilley / linq-javascript-where-contains-comparison.txt
Last active Oct 29, 2019
LINQ Where Contains to JavaScript using Underscore JS
View linq-javascript-where-contains-comparison.txt
//A common thing to remember
myList.Where(l => otherList.Contains(l.Id));
_.filter(this.myList(), l => {
return _.contains(otherList, l.id);
});
@rswilley
rswilley / index.html
Created Apr 15, 2019
Knockout + Bootstrap Radio Buttons with KO Validation Example
View index.html
<label class="ov-label">Options</label>
<div data-bind="foreach: optionList, validationOptions: {insertMessages: false}">
<div class="radio">
<label>
<input data-bind="checked: $parent.selectedOptionId, value: id" type="radio" name="optionGroup">
<!-- ko text: name --><!--/ko-->
</label>
</div>
</div>
@rswilley
rswilley / wget.txt
Created Mar 9, 2019
Download an entire site with wget. I've used this as a first step to convert an existing site to a static site.
View wget.txt
$ wget \
--recursive \
--no-clobber \
--page-requisites \
--html-extension \
--convert-links \
--restrict-file-names=windows \
--domains website.org \
--no-parent \
www.website.org/tutorials/html/
@rswilley
rswilley / HttpGetRequestSync.cs
Created Oct 24, 2017 — forked from dantheman213/HttpGetRequestSync.cs
C# HTTP GET request synchronous example
View HttpGetRequestSync.cs
using System.Net.Http;
using (var client = new HttpClient())
{
var url = "http://google.com/api-example";
var response = client.GetAsync(url).Result;
if (response.IsSuccessStatusCode)
{
// by calling .Result you are performing a synchronous call
@rswilley
rswilley / jobs.js
Created Oct 12, 2017 — forked from maximilianschmitt/jobs.js
Automated MySQL backups to S3 with node.js
View jobs.js
'use strict';
var mysqlBackup = require('./mysql-backup');
var schedule = require('node-schedule');
schedule.scheduleJob({ hour: 22, minute: 0 }, mysqlBackup);
@rswilley
rswilley / Debug-Knockout-JS.html
Created Sep 29, 2017 — forked from maxcnunes/Debug-Knockout-JS.html
Simple way to debug viewmodel data bind with knockout
View Debug-Knockout-JS.html
<pre data-bind="text: ko.toJSON($data, null, 2)"></pre>
You can’t perform that action at this time.