Skip to content

Instantly share code, notes, and snippets.

View AndrewBarfield's full-sized avatar

Andrew Barfield AndrewBarfield

View GitHub Profile
@AndrewBarfield
AndrewBarfield / Web-Worker-Script-for-"Calculating-Pi-in-a-Web-Worker".markdown
Created December 29, 2014 19:50
Web Worker Script for "Calculating Pi in a Web Worker"
@AndrewBarfield
AndrewBarfield / Bootstrap-Image-Video-Gallery-.markdown
Created December 29, 2014 20:02
Bootstrap Image/Video Gallery
@AndrewBarfield
AndrewBarfield / HTML5-Web-Terminal-Script.markdown
Created December 31, 2014 16:52
HTML5 Web Terminal Script

HTML5 Web Terminal Script

A console for the Web written in completely in JavaScript. The console supports Web versions of some Linux commands. This work is based, in part, on earlier work by Eric Bidelman.

A Pen by Andrew Mitchell Barfield on CodePen.

License.

@AndrewBarfield
AndrewBarfield / Calculate-Pi-to-5,000-digits-in-a-Web-Worker.markdown
Last active August 29, 2015 14:13
Calculate Pi to 5,000 digits in a Web Worker
@AndrewBarfield
AndrewBarfield / Fibonacci-Sequence-in-a-Web-Worker.markdown
Created January 15, 2015 00:34
Fibonacci Sequence in a Web Worker
@AndrewBarfield
AndrewBarfield / gist:2552163
Created April 29, 2012 17:37
PowerShell: Generate a set of N random integers between -9 and 9
cls
$N = 5;
# --------------------------------------------------------------------------------
#
# FUNCTION NAME: GenerateSet
#
# DESCRIPTION: Generates a set of N random integers between -9 and 9
#
# --------------------------------------------------------------------------------
@AndrewBarfield
AndrewBarfield / gist:2556422
Created April 30, 2012 08:05
C#: Bit Twiddling: Determine the minimum or maximum of two integers
using System;
namespace BitTwiddling {
class Program {
// Compute the minimum of two integers without branching
static int Min(int x, int y) {
return y + ( ( x - y ) & ( ( x - y ) >> ( sizeof( int ) * 8 - 1 ) ) );
}
// Compute the maximum of two integers without branching
@AndrewBarfield
AndrewBarfield / gist:2556400
Created April 30, 2012 08:01
C#: System.Collections: Display binary values using BitArray class
using System;
using System.Collections;
namespace BitArrayExample {
class Program {
static void Main(string[] args) {
bool le = BitConverter.IsLittleEndian;
if ( le ) {
@AndrewBarfield
AndrewBarfield / gist:2556440
Created April 30, 2012 08:09
C#: delegate: Calling static and instance methods with delegates
using System;
namespace DelegateExample {
class Program {
// Declares a delegate for the methods
public delegate String myMethodDelegate();
// Defines an instance and static method
public class myMethodsClass {
@AndrewBarfield
AndrewBarfield / gist:2556506
Created April 30, 2012 08:18
C#: System.Collections.Generic: Custom Generic list class
using System;
using System.Collections.Generic;
namespace GenericList {
class Program {
static void Main(string[] args) {
// int is the type argument
GenericList<int> list = new GenericList<int>();
for ( int x = 0 ; x < 10 ; x++ ) {