Skip to content

Instantly share code, notes, and snippets.

View bkawk's full-sized avatar

Will Hill bkawk

  • Digital Dreams
  • Earth
View GitHub Profile
@bkawk
bkawk / learn.js
Last active May 29, 2017 22:41
Programming Fundamentals
/**
* START
* --------------------
* Go to http://jsbin.com,
* Hit the X in the top left corner
* Ensure only JavaScript and Console are selected in the midlle
* Enter code in the JavaScript window and see the results in the console
* Copy in each of the blocks below into the jacascript window
* Then in the top right hand cornr of the console press clear and then run
* The coding style and patterns here is the accepted modern norm, you will see older styles in the wild
@bkawk
bkawk / sql-query.js
Last active May 24, 2017 02:51
Send SQL statement to MySQL
// This file does only one thing it can not call on other functions
const mysql = require('mysql');
const connection = mysql.createConnection({
host : process.env.MYSQL_HOST,
user : process.env.MYSQL_USER,
password : process.env.MYSQL_PASSWORD,
database : process.env.MYSQL_DATABASE
});
@bkawk
bkawk / assert.js
Created June 12, 2017 12:44
Web component testing cheat sheet
<script>
suite('caja-sanitizer', function() {
test('testdiv is equal to one', function() {
// Setup
var element = fixture('BasicTestFixture');
var elementShadowRoot = element.shadowRoot;
// Select Stuff
var div1 = elementShadowRoot.querySelector('#div1');
var div2 = elementShadowRoot.querySelector('.div2');
@bkawk
bkawk / base64-s3.js
Last active July 14, 2017 17:00
Base64 Image upload to Amazon S3
'use strict';
const aws = require('aws-sdk');
exports.s3PutBase64 = (image, folder, imageName) => {
return new Promise(function(resolve, reject) {
const buf = new Buffer(image.replace(/^data:image\/\w+;base64,/, ""), 'base64');
const s3 = new aws.S3();
aws.config = {
@bkawk
bkawk / spp.txt
Created July 15, 2017 00:18
South Park Production
Morning ideas and jokes, in writers meeting
boil down ideas
Not afraid of throwing ideas around
Progression of ideas that ends up being somthing
When ofence is caused they know they have somthing good
Sketches
Inking
Animation
Everybody does everything
fast turn around
@bkawk
bkawk / int.sol
Last active July 21, 2017 00:01
Contract Lessons
pragma solidity ^0.4.0;
contract myAge {
uint age = 41;
function getAge() constant returns(uint){
return age;
}
}
@bkawk
bkawk / reduce.js
Last active October 15, 2017 09:17
Reduce with promise
function _test(actions){
return actions.reduce((chain, action) => {
return chain.then(() => action.functionToCall(action.argumentToSend)).then(val => console.log(val));
}, Promise.resolve());
}
function _one(data){
return new Promise((resolve, reject) => {
setTimeout(function(){
console.log(data);
@bkawk
bkawk / .bashrc
Created December 4, 2017 01:09
EOS Install
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
@bkawk
bkawk / config.ini
Last active December 4, 2017 21:12
EOS Config File
get-transactions-time-limit = 3
block-log-dir = "blocks"
block-interval-seconds = 1
rcvd-block-trans-execution-time = 72
trans-execution-time = 18
create-block-trans-execution-time = 18
per-authorized-account-transaction-msg-rate-limit = 1800
per-code-account-transaction-msg-rate-limit-time-frame-sec = 18
per-code-account-transaction-msg-rate-limit = 18000
per-code-account-max-storage-db-limit-mbytes = 5
@bkawk
bkawk / etc-nginx-sites-available-default
Last active December 12, 2017 10:19
basic server setup
server {
listen 80;
listen [::]:80;
server_name test.swarmdev.city;
location / {
proxy_pass http://127.0.0.1:8088;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';