Skip to content

Instantly share code, notes, and snippets.

View sbrl's full-sized avatar

Starbeamrainbowlabs sbrl

View GitHub Profile
#!/bin/bash
#from https://gist.github.com/sbrl/4a642df930051575d91a
public=true
desc="(none)"
for i; do
case "$i" in
-p)
public=false
@sbrl
sbrl / nanoModal-position-text.html
Last active August 29, 2015 14:14
A test of kylepaulsen/NanoModal to demonstrate a positioning bug.
<!DOCTYPE html>
<html>
<head>
<title>nanoModal Test</title>
</head>
<body>
<h1>nanoModal Test</h1>
<p><strong>Scroll down and click the button</strong></p>
@sbrl
sbrl / valuevsreference.cs
Created February 5, 2015 09:59
A simple test of setting via value and setting via reference.
using System;
using System.Diagnostics;
class ValueVsReference
{
public static void SetValue(int somenumber, int maxi)
{
for (int i = 0; i < maxi; i++)
{
somenumber = i;
@sbrl
sbrl / explode_adv.php
Created May 21, 2015 10:09
Probably (not) the world's most advanced string splitting function.
<?php
/*******************************
* An advanced string splitting function written in PHP.
* Blog Post: https://starbeamrainbowlabs.com/blog/article.php?article=posts%2F077-PHP-String-Splittting.html
* Written by Starbeamrainbowlabs.
* Website: https://starbeamrainbowlabs.com
* Twitter: @SBRLabs
*/
function explode_adv($openers, $closers, $togglers, $delimiters, $str)
{
@sbrl
sbrl / first_test.js
Created June 2, 2015 11:43
ES6 Generators 1 Source Code used in a blog post.
function *first_test()
{
yield "Hello!";
yield "I am a generator!";
yield "This is the last thing I will yield.";
}
var test = first_test(),
next = test.next();
@sbrl
sbrl / maze.lua
Created June 24, 2015 19:47
A maze generation algorithm written in lua.
-------------------------------------
-- Maze generation script
-------------------------------------
-- A test by @Starbeamrainbowlabs
---------------------------------------------
-- Intelligent table printing function
---------------------------------------------
-- From http://coronalabs.com/blog/2014/09/02/tutorial-printing-table-contents/
@sbrl
sbrl / spelling-list-parser.cs
Created September 9, 2015 06:37
Code to parse wikipedia's list of spelling correction into a format that @TheTypoMaster's code can understand. The headers / footers must be removed manually.
using System;
using System.IO;
public class Program
{
public static void Main()
{
StreamReader source = new StreamReader("wikipedia-spelling-corrections.txt");
StreamWriter dest = new StreamWriter("wikipedia-spelling-corrections-new.txt");
while(!source.EndOfStream)
@sbrl
sbrl / node-update
Created October 6, 2015 14:04
A simple bash script to update Node.js to the latest version.
#!/bin/bash
echo "> Getting latest version number"
VERSION=v${1:-$(curl https://nodejs.org/dist/index.json | sed -e 's/^.*"version":"\([^"]*\)".*$/\1/' | head -n 2 | tail -n -1 | cut -c 2-)}
NODEJS=node-${VERSION}-linux-x64
echo "> Downloading $VERSION of node.js"
curl -s https://nodejs.org/dist/${VERSION}/${NODEJS}.tar.xz | tar xvfJ -
echo "> Setting ownership of /usr/local to $USER"
@sbrl
sbrl / keybase.md
Created December 14, 2015 13:19
Keybase GitHub verification

Keybase proof

I hereby claim:

  • I am sbrl on github.
  • I am sbrl (https://keybase.io/sbrl) on keybase.
  • I have a public key whose fingerprint is C2F7 843F 9ADF 9FEE 264A CB9C C1C6 C0BB 001E 1725

To claim this, I am signing this object:

@sbrl
sbrl / drawShape.js
Last active December 19, 2015 16:18
Draws a n sided shape of radius r to the given context.
function drawShape(context, pos, sides, radius, rotation)
{
if(typeof radius !== "number")
rotation = 0;
console.log(`Drawing shape at ${pos.toString()}. Sides: ${sides}, Radius: ${radius}`);
context.save();
context.translate(pos.x, pos.y);