Skip to content

Instantly share code, notes, and snippets.

View kylekellogg's full-sized avatar
👨‍💻
Doing my best

Kyle Kellogg kylekellogg

👨‍💻
Doing my best
View GitHub Profile
@kylekellogg
kylekellogg / gooby pls
Last active October 8, 2015 06:08
gooby function for bash shell. Takes parameter pls to return fak you dolan. If pls is not set, will return wat?.
function gooby() {
if [ -n $1 ] && [ "$1" = "pls" ]
then
echo "fak you dolan"
else
echo "wat?"
fi
}
@kylekellogg
kylekellogg / js-timers
Created August 26, 2013 14:54
Simple example to display preserving reference of `this` with JS timers.
var a = new function() {
this.name = "testing";
this.do = function() {
console.log( "doing with " + this.name );
};
};
setTimeout( a.do.call( a ), 100 );
setTimeout( a.do, 100 );
@kylekellogg
kylekellogg / InternetConnectivity.cs
Created September 24, 2013 14:18
A C# class for Unity3D to determine internet availability. Author is Andy Zupko (https://github.com/azupko).
public class InternetConnectivity : MonoBehaviour
{
public float maxTime = 5;
public float currentTime = 0;
const float successRetry = 20;
const float failRetry = 2;
public static bool hasConnection { get; private set; }
public void OnEnable() {
StartCoroutine( ConnectivityLoop() );
@kylekellogg
kylekellogg / MKSampleAppDelegate.m
Created November 19, 2013 22:38
Sample AppDelegate.m for application using MyKarma SDK
#import "AppDelegate.h"
#import "MKManager.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[MKManager sharedManager] registerWithAppKey:@"APP KEY"
secret:@"APP SECRET"
successHandler:^(void) {
@kylekellogg
kylekellogg / MKSampleViewController.m
Last active December 28, 2015 19:59
Sample ViewController.m for MyKarma SDK
#import "ViewController.h"
#import "MKInterstitialView.h"
@interface ViewController () <MKInterstitialViewDelegate>
@property (strong, nonatomic) MKInterstitialView *interstitialView;
@end
@implementation ViewController
@kylekellogg
kylekellogg / f2j.sh
Created March 6, 2014 03:01
Cucumber (Gherkin) feature file to JIRA comment formatter. Takes a path to a single .feature file and will output the JIRA comment-friendly formatted version in the terminal.
#!/usr/bin/env bash
# Ensure only one file at a time
if [[ $# -ne 1 ]]
then
echo ""
echo "Usage $0 path/to/file.feature"
echo ""
exit 1
fi
@kylekellogg
kylekellogg / cgrep.sh
Created March 10, 2014 18:27
Example for 34.18 (article is titled "Searching for Patterns Split Across Lines" and is in the sed chapter of the book) of "Unix Power Tools". If you can explain this in a way that is more sensible than the book, I would be extremely grateful.
#!/bin/sh
# cgrep - multiline context grep using sed
# Usage: cgrep [-context] pattern [file...]
n=3
case $1 in -[1-9]*)
n=`expr 1 - "$1"`
shift
esac
re=${1?}; shift
@kylekellogg
kylekellogg / dos2unix.bat
Created April 4, 2014 05:04
Recursive sed based solution for converting line endings from Unix to DOS format
#!/usr/bin/env bash
for /r %%i in (*) do (
pushd "%%i"
for /f in (dir /b * 2^>nul) do (
# Something similar to the above using this below sed command
if [[ -f $file ]]
then
#sed "s/$//"
echo "Converting $file"
@kylekellogg
kylekellogg / introrx.md
Last active August 29, 2015 14:08 — forked from staltz/introrx.md

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@kylekellogg
kylekellogg / pmgj_march_2015.md
Last active August 29, 2015 14:18
Game submission for Purple Monkey Game Jam (March 2015) by Kyle Kellogg, Kris Kellogg, and Tyler Gates.

Purple Monkey Game Jam Game Submission

This is for the itch.io game made for PMGJ of March 2015

For the theme, "With Our Powers Combined", we created a tabletop card game. Here's the tl;dr version:

A group of wizards band together to clear a cave system of it's elemental monster
inhabitants. While not powerful enough individually, they are able to join their
spells together to overcome the great difficulties facing them.