Skip to content

Instantly share code, notes, and snippets.

@jakejscott
jakejscott / rethink trace
Created February 23, 2016 02:48
rethink trace
dbug: RethinkDb.Driver[0]
JSON Send: Token: 13, JSON: [1,[56,[[15,[[14,["sprightly"]],"paypal_transaction"]],{"id":"1deb3e7f-27d9-4d2b-a845-cb11b92eb601","InvoiceNumber":"f91fcbc0-ca03-40c1-af54-965c0aa21422","PaypalPaymentId":"PAY-4AY01112CS5299253K3F4QGQ","PaypalPayerId":null,"PaypalCreatedPayment":{"id":"PAY-4AY01112CS5299253K3F4QGQ","intent":"sale","payer":{"payment_method":"paypal"},"transactions":[2,[{"related_resources":[2,[]],"amount":{"currency":"USD","total":"100.00","details":{"subtotal":"75.00","shippin
g":"10.00","tax":"15.00"}},"description":"Transaction description.","invoice_number":"f91fcbc0-ca03-40c1-af54-965c0aa21422","item_list":{"items":[2,[{"quantity":"5","name":"Item Name","price":"15.00","currency":"USD","sku":"sku"}]]}}]],"state":"created","create_time":"2016-02-23T02:46:50Z","links":[2,[{"href":"https://api.sandbox.paypal.com/v1/payments/payment/PAY-4AY01112CS5299253K3F4QGQ","rel":"self","method":"GET"},{"href":"https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkou
@jakejscott
jakejscott / 9421027891050.json
Created January 18, 2016 09:34
9421027891050
{
"Id": "1005245",
"Sku": "9421027891050",
"Brand": "Boundary Road Brewery",
"Name": "Bouncing Czech Pilsener Lager 12 x 330ml Bottles",
"Description": "",
"Quantity": 0,
"Size": "3960 ml",
"Sizes": [],
"Category": "Liquor",
@jakejscott
jakejscott / main.go
Created September 16, 2015 01:35
simple-go
package main
import (
"database/sql"
"fmt"
"github.com/superlogical/simple-go/Godeps/_workspace/src/github.com/go-gorp/gorp"
_ "github.com/superlogical/simple-go/Godeps/_workspace/src/github.com/go-sql-driver/mysql"
"github.com/superlogical/simple-go/log"
"github.com/superlogical/simple-go/util"
"net/http"
@jakejscott
jakejscott / setup_winrm.txt
Last active September 1, 2015 00:59 — forked from mitchellh/setup_winrm.txt
Packer 0.8 Windows Example on AWS
<powershell>
winrm quickconfig -q
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="300"}'
winrm set winrm/config '@{MaxTimeoutms="1800000"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'
netsh advfirewall firewall add rule name="WinRM 5985" protocol=TCP dir=in localport=5985 action=allow
netsh advfirewall firewall add rule name="WinRM 5986" protocol=TCP dir=in localport=5986 action=allow
@jakejscott
jakejscott / KeyGenerator.cs
Created July 13, 2015 22:20
Hash tag key generator
using System;
namespace Microsoft.Web.Redis
{
internal class KeyGenerator
{
private string id;
public string DataKey
{
@jakejscott
jakejscott / table-row-toggle.js
Created June 24, 2015 03:26
Vanilla JS Table row toggle
function getClosest(elem, selector) {
var firstChar = selector.charAt(0);
for (; elem && elem !== document; elem = elem.parentNode) {
if (firstChar === '.') {
if (elem.classList.contains(selector.substr(1))) {
return elem;
}
}
if (firstChar === '#') {
if (elem.id === selector.substr(1)) {
@jakejscott
jakejscott / UnixDate.cs
Created June 12, 2015 03:49
UnixDate.cs
public static class UnixDateTime
{
public static DateTimeOffset FromUnixTimeSeconds(long seconds)
{
if (seconds < -62135596800L || seconds > 253402300799L)
throw new ArgumentOutOfRangeException("seconds", seconds, "");
return new DateTimeOffset(seconds * 10000000L + 621355968000000000L, TimeSpan.Zero);
}
@jakejscott
jakejscott / channels.rs
Last active December 23, 2017 02:42
rust channels and threads
use std::thread;
use std::sync::mpsc::channel;
use std::sync::mpsc::sync_channel;
// Create a simple streaming channel
fn example1() {
// (tx for transmission)
// (rx for receiving)
let (tx, rx) = channel();
@jakejscott
jakejscott / main.rs
Created April 11, 2015 00:39
Playing around with rust
use std::fmt;
#[derive(Debug)]
struct Person {
name: String,
age: i32,
}
impl fmt::Display for Person {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@jakejscott
jakejscott / main.cs
Last active August 29, 2015 14:18
postgres-queue
using System;
using System.Linq;
using System.Timers;
using Dapper;
using Npgsql;
namespace PostgresQueue
{
public class Program
{