Skip to content

Instantly share code, notes, and snippets.

Avatar

Starbeamrainbowlabs sbrl

View GitHub Profile
View upload-gist.sh
#!/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 Aug 29, 2015
A test of kylepaulsen/NanoModal to demonstrate a positioning bug.
View nanoModal-position-text.html
<!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 Feb 5, 2015
A simple test of setting via value and setting via reference.
View valuevsreference.cs
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
Probably (not) the world's most advanced string splitting function.
View explode_adv.php
<?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 Jun 2, 2015
ES6 Generators 1 Source Code used in a blog post.
View first_test.js
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 Jun 24, 2015
A maze generation algorithm written in lua.
View maze.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 Sep 9, 2015
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.
View spelling-list-parser.cs
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 Oct 6, 2015
A simple bash script to update Node.js to the latest version.
View node-update
#!/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 Dec 14, 2015
Keybase GitHub verification
View keybase.md

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 Dec 19, 2015
Draws a n sided shape of radius r to the given context.
View drawShape.js
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);