Skip to content

Instantly share code, notes, and snippets.

View justingolden21's full-sized avatar
💻
Always coding 👍

Justin Golden justingolden21

💻
Always coding 👍
View GitHub Profile
@djsutherland
djsutherland / example.hmm
Created November 1, 2011 05:10
Code for a Hidden Markov Model, along with some sample data / parameters for testing.
4 # number of states
START
COLD
HOT
END
3 # size of vocab
1
2
3
@dxdydz
dxdydz / liarsdice.py
Created April 18, 2012 04:45
Python Liar's Dice
import random
import time
NUMBERWORDS = 'zero one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty twenty-one twenty-two twenty-three twenty-four twenty-five'.split()
NUMBERPLURALS = 'q ones twos threes fours fives sixes'.split()
names = 'Josie Henry Catherine Alice Henrietta Joseph Alistair Conrad Gary Bethany Susan Kirstie Maverick Mason Sophie Claire'.split()
def pause():
time.sleep(1)
@mshafrir
mshafrir / states_hash.json
Created May 9, 2012 17:05
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@mbostock
mbostock / .block
Last active December 11, 2023 06:50 — forked from hail2u/twitter-bird.svg
Twitter SVG Logo
license: gpl-3.0
@demonixis
demonixis / toggleFullscreen.js
Created March 18, 2013 16:07
A simple function to toggle fullscreen in JavaScript. It work well on Firefox and Webkit browsers.
/**
* Toggle fullscreen function who work with webkit and firefox.
* @function toggleFullscreen
* @param {Object} event
*/
function toggleFullscreen(event) {
var element = document.body;
if (event instanceof HTMLElement) {
element = event;
@dconnolly
dconnolly / README.md
Last active June 7, 2024 07:42
All 100 Chromecast background images that are rotated through, linked to their original locations on Google hosting. Links to 2560 width versions, where available.
@roundand
roundand / OpenWithSublimeText3.bat
Last active June 29, 2024 01:16 — forked from mrchief/LICENSE.md
Open folders and files with Sublime Text 3 from windows explorer context menu (tested in Windows 7)
@echo off
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe
rem add it for all file types
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f
rem add it for folders
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f
@daniellevass
daniellevass / android_material_design_colours.xml
Last active June 5, 2024 13:54
Android Material Design Colours
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>
@ruiokada
ruiokada / suntimes.js
Last active March 27, 2024 16:49
Calculate sunrise/sunset times from latitude/longitude coordinates using Javascript.
/**
* Calculates today's sunrise and sunset hours in local time (or in the given tz) for the given latitude, longitude.
* The tz parameter is mainly for the possible circumstance that your system timezone does not match the location
* you are currently at.
*
* Computations are based on the formulas found in:
* https://en.wikipedia.org/wiki/Julian_day#Converting_Julian_or_Gregorian_calendar_date_to_Julian_Day_Number
* https://en.wikipedia.org/wiki/Sunrise_equation#Complete_calculation_on_Earth
*
* @method suntimes
@FreyaHolmer
FreyaHolmer / int2.cs
Last active November 2, 2023 15:59
int2 type for Unity
/////////////////////////////////////////////////////////////////////////////
// int2 is similar to Vector2, but with integers instead of floats
// Useful for various grid related things.
//
// - Swizzle operators xx/xy/yx/yy
// - Extended arithmetic operators similar to shader data types
// A few examples:
// int2(8,4) / int2(2,4) -> int2(4,1)
// 16 / int2(2,4) -> int2(8,4)
// int2(2,3) * int2(4,5) -> int2(8,15)