Skip to content

Instantly share code, notes, and snippets.

View robwhitaker's full-sized avatar

Robert Whitaker robwhitaker

View GitHub Profile
@robwhitaker
robwhitaker / ElmMouseOver
Created February 24, 2015 17:19
Elm - Basic Form MouseOver Collision
import Graphics.Collage (..)
import Graphics.Element (..)
import Color (blue)
import Text (plainText)
import Window
import Signal
import Mouse
main : Signal Element
main = Signal.map3 (\x y m -> let
@robwhitaker
robwhitaker / swift-lab6
Created March 4, 2015 18:05
swift-lab6
class Shape {
var title = "shape"
func area() -> Double {
return 0.0
}
func description() -> String {
return "I am a \(title). My area is \(area())."
}
@robwhitaker
robwhitaker / ReadyListener.js
Created August 11, 2015 23:09
Just a simple utility class for some callback handling.
function ReadyListener(config) {
this.properties = config || {};
this.onReady = function() {};
}
ReadyListener.prototype.ready = function(key) {
this.properties[key] === false && (this.properties[key] = true);
var isReady = true;
for(k in this.properties) isReady = isReady && this.properties[k];
isReady && this.onReady();
@robwhitaker
robwhitaker / MMPHalloween2015Testing.md
Last active October 27, 2015 22:55
MMP Halloween 2015 Testing

Requirements

  • Elm v0.15.1

Instructions

  1. Fork this repository: https://github.com/robwhitaker/MMPHalloween2015

  2. cd into the forked folder and run elm package install

  3. Once the packages are installed, run elm reactor

import Graphics.Element exposing (..)
import Window
import Graphics.Input exposing (..)
main : Signal Element
main = Signal.map content Window.dimensions
divI a b = round (toFloat a / b)
content : (Int, Int) -> Element
// Write a function `hipsterfy(sentence)` that takes takes a string containing
// several words as input. Remove the last vowel from each word. `'y'` is not a vowel.
function isVowel(char) {
return ["a","e","i","o","u"].indexOf(char.toLowerCase()) !== -1;
}
function hipsterfy(str) {
return str.split("").reverse().reduce(function(acc, char) {
if(isVowel(char) && acc.needLastVowel)
function hasDuplicates(arr) {
var exists = {};
for(var i = 0; i < arr.length; i++)
if(exists[arr[i]])
return true;
else
exists[arr[i]] = true;
return false;
}
function mindPsAndQs(input) {
return input.match(/[PQ]+/g).reduce(function(acc, str) {
return Math.max(acc, str.length);
}, 0);
}
@robwhitaker
robwhitaker / TweegoSetup.md
Last active September 22, 2022 05:02
Setting up Tweego w/ SugarCube 2.20 & Sublime Text 2 / VSCode

Tweego Setup

Note:

  • 2020-02-24 - Several things have changed since I wrote this back in 2017. I suggest checking out AnotherEpigone's comment below before trying to follow this guide.

Downloading and installing Tweego

You can download Tweego from the (hard to find) Tweego page on the Motoslave website. Compiled executables are available for Windows, Mac, and Linux, or you can follow the link on that page to Bitbucket to compile it yourself from source (instructions on Bitbucket).

There is no installer. Once you download the executable, add it to your PATH and you're all set to use Tweego...

@robwhitaker
robwhitaker / cVimrc
Last active December 23, 2019 20:38
Config for cVim
set smoothscroll
set autohidecursor
set noautofocus
set sortlinkhints
set scalehints
set autoupdategist
let searchengine duckduckgo = ["https://duckduckgo.com", "https://duckduckgo.com/?q="]
let searchengine ecosia = ["https://www.ecosia.org", "https://www.ecosia.org/search?q="]
let searchengine startpage = ["https://www.startpage.com", "https://www.startpage.com/do/search?query="]