Skip to content

Instantly share code, notes, and snippets.

View jonfriesen's full-sized avatar
🪐
hey there!

Jon Friesen jonfriesen

🪐
hey there!
View GitHub Profile
@jonfriesen
jonfriesen / linkedlist.php
Created July 23, 2014 05:31
PHP Linked List
<!--
Filename: linkedlist.php
Creation Date: July 22, 2014
Purpose: Create a basic linked list
-->
<?php
class Node
{
private $object;
function getWhoIsServer(domain) {
var host = '';
dns.resolveCname(server, function(err, addresses)
{
console.log(err);
if(!err) {
host = addresses[0];
} else {
console.log('Using alternate server '+server);
host = server;
@jonfriesen
jonfriesen / gist:5424952
Created April 20, 2013 06:10
Playing with events and delegates. I'm having difficulty wrapping my head around the entire concept... From what I gathered everything revolves around the delegate concept. Events reference the delegate as the type, and when they are triggered they must use the same parameters that the delegate has. The delegate links the event to the code that …
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
delegate void TaskUpdateHandler(object sender, EventArgs e); // Why does this have to be outside of the namespace?
namespace DelegatesEventsLambda
{
/** Inner class for entries */
protected static class MyEntry<K,V> implements Entry<K,V> {
protected K k; // key
protected V v; // value
public MyEntry(K key, V value) {
k = key;
v = value;
}
// methods of the Entry interface
public K getKey() { return k; }
package Lab08;
import java.util.Random;
public class AirlineStandbyQueue {
private SortedListAdaptablePriorityQueue<Integer, Passenger> q;
public static void main(String[] args)
{
new AirlineStandbyQueue();
}
@jonfriesen
jonfriesen / hashstairs-recursive.js
Last active June 11, 2016 23:12
Create a set of stairs using hashes
// Build a function that draws a set of stairs using hashes
// that climb vertically from left to right. The bottom stairs
// should have no spaces in front of it, for example:
// This is a set of 3
// #
// ##
//###
function hashStairs(num, spaces, notFirstRun) {
@jonfriesen
jonfriesen / braceBalanceChecker.js
Created June 12, 2016 03:51
Simple kata for finding if a string has balanced braces (no other characters). Solves a simple programming interview question a friend had to do.
function isArrayBalanced(inputArray) {
function isBalanced(input) {
Array.prototype.peek = function() {
return this[this.length - 1];
};
if (input.length % 2 !== 0) return "NO";
var braceStack = [];
var braceMap = {
"}" : "{",
"]" : "[",
@jonfriesen
jonfriesen / OwinFileServerControl.cs
Last active June 12, 2016 03:53
Creates a http file server, if /exit is called server is shutdown
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Owin.Hosting;
using Owin;
using Microsoft.Owin.FileSystems;
using Microsoft.Owin.StaticFiles;
using System.Threading;
[{"id":"5153fe16-9035-4ba7-ac3d-afd478402235","first_name":"Dennis","last_name":"Parker","domain":"macromedia.com","email":"Dennis.Parker@macromedia.com","gender":"Male","city":"Nyazepetrovsk","address":"8 Boyd Avenue","phone_number":"7-(908)778-0060"},
{"id":"4672aba7-bf14-4ec7-a426-b0f266cdd4a6","first_name":"Donna","last_name":"Evans","domain":"microsoft.com","email":"Donna.Evans@microsoft.com","gender":"Female","city":"Ambanja","address":"740 Hazelcrest Place","phone_number":"261-(502)571-6547"},
{"id":"4aa83d08-90bd-4b5e-bfb3-bf21c925bc2d","first_name":"Edward","last_name":"Jenkins","domain":"ning.com","email":"Edward.Jenkins@ning.com","gender":"Male","city":"Patabog","address":"9853 Chinook Pass","phone_number":"63-(763)910-9686"},
{"id":"15dd7efb-cbef-407a-9181-7e6ac3614dcf","first_name":"Lori","last_name":"Lawson","domain":"usa.gov","email":"Lori.Lawson@usa.gov","gender":"Female","city":"Qiawan","address":"47062 Harper Point","phone_number":"86-(778)959-1236"},
{"id":"27ebe034-8f2c-44b5-8b68-201ff558f
service: my-bucket-test
provider:
name: aws
runtime: nodejs6.10
functions:
hello:
handler: handler.hello
events:
- s3:
bucket: testbucket