Skip to content

Instantly share code, notes, and snippets.

View rswilley's full-sized avatar
🏠
Working from home

Robert Swilley rswilley

🏠
Working from home
View GitHub Profile
@rswilley
rswilley / Debug-Knockout-JS.html
Created September 29, 2017 13:43 — forked from maxcnunes/Debug-Knockout-JS.html
Simple way to debug viewmodel data bind with knockout
<pre data-bind="text: ko.toJSON($data, null, 2)"></pre>
@rswilley
rswilley / jobs.js
Created October 12, 2017 15:47 — forked from maximilianschmitt/jobs.js
Automated MySQL backups to S3 with node.js
'use strict';
var mysqlBackup = require('./mysql-backup');
var schedule = require('node-schedule');
schedule.scheduleJob({ hour: 22, minute: 0 }, mysqlBackup);
@rswilley
rswilley / HttpGetRequestSync.cs
Created October 24, 2017 14:20 — forked from dantheman213/HttpGetRequestSync.cs
C# HTTP GET request synchronous example
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 / wget.txt
Created March 9, 2019 12:11
Download an entire site with wget. I've used this as a first step to convert an existing site to a static site.
$ 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 / index.html
Created April 15, 2019 19:04
Knockout + Bootstrap Radio Buttons with KO Validation Example
<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 / linq-javascript-where-contains-comparison.txt
Last active October 29, 2019 17:34
LINQ Where Contains to JavaScript using Underscore JS
//A common thing to remember
myList.Where(l => otherList.Contains(l.Id));
_.filter(this.myList(), l => {
return _.contains(otherList, l.id);
});
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using ValTool = System.ComponentModel.DataAnnotations;
namespace Validation
{
public class Validator
{
public List<ValidationResult> ValidationErrors { get; private set; }