Skip to content

Instantly share code, notes, and snippets.

View dag0310's full-sized avatar

Daniel Geymayer dag0310

View GitHub Profile
@sobels
sobels / life.d
Created October 20, 2014 20:41
Conway's Game of Life, using D metaprogramming
enum height = 5;
enum width = 5;
enum iterations = 20;
enum initialState = [
0, 1, 0, 1, 1,
0, 0, 0, 0, 1,
1, 1, 0, 0, 0,
1, 1, 1, 1, 1,
@andrewabest
andrewabest / Deploy.ps1
Created February 2, 2014 22:49
An example Octopus deployment script for WPF ClickOnce applications.
Write-Host 'Copy the package payload over to the clickonce web application location'
$source = ".\"
$dest = "C:\Octopus\Applications\${OctopusEnvironmentName}\NextGen.ClickOnce\${OctopusPackageVersion}\Package"
$exclude = @('*.pdb','mage.exe', '*.ps1', '*Build*', '*.pfx')
$appManifestName = "${OctopusPackageName}.exe.manifest"
$appManifestPath = Join-Path $dest $appManifestName
$deployManifestPath = Join-Path $dest "${OctopusPackageName}.application"
@rachelbaker
rachelbaker / object-storage.js
Created August 6, 2013 02:00
Extending Local Storage to save and get Objects
/**
* Extending the Local Storage Object to allow saving of objects.
*
* @param int|string key object key
* @param int|string value object value
* @return bool true|false
*/
Storage.prototype.setObject = function(key, value) {
this.setItem(key, JSON.stringify(value));
};
@jcward
jcward / random.js
Last active July 22, 2018 16:50
Quick Math.random() wrapper with support for window.crypto.getRandomValues
// Math.random() wrapper with support for window.crypto.getRandomValues
// return a random number, 0 <= rand() < 1
function rand() {
if (window.crypto && window.crypto.getRandomValues && (typeof Uint8Array=='function')) {
var buf = new Uint8Array(4);
window.crypto.getRandomValues(buf);
// buf = [0,0,0,0]; // 0
// buf = [255,255,255,255]; // closest to 1
// buf = [0,0,0,128]; // < 0.5
// buf = [1,0,0,128]; // > 0.5
@thomasnordlund
thomasnordlund / authRoute.js
Created November 6, 2012 16:19 — forked from xcambar/LICENSE
Authenticated routing using AngularJS
authRouteProvider.$inject = ['$routeProvider'];
function authRouteProvider ($routeProvider) {
/**
* Creates a controller bound to the route, or wraps the controller in param
* so the authentication check is run before the original controller is executed
* @param currentController
* @return {Function} The wrapper controller
*/
function redirectCtrlFactory (currentController) {
_ctrl.$inject = ['currentUser__', 'userRole__', '$location'];
@devthue
devthue / git-ignore-local.md
Created August 12, 2016 04:18
Git ignore files only locally

Sources: http://stackoverflow.com/questions/1753070/git-ignore-files-only-locally

The .git/info/exclude file has the same format as any .gitignore file. Another option is to set core.excludesFile to the name of a file containing global patterns.

Note, if you already have unstaged changes you must run the following after editing your ignore-patterns:

git update-index --assume-unchanged [<file>...]

Note on $GIT_DIR: This is a notation used all over the git manual simply to indicate the path to the git repository. If the environment variable is set, then it will override the location of whichever repo you're in, which probably isn't what you want.

@jcxplorer
jcxplorer / uuid.js
Created February 12, 2011 16:58
UUID v4 generator in JavaScript (RFC4122 compliant)
function uuid() {
var uuid = "", i, random;
for (i = 0; i < 32; i++) {
random = Math.random() * 16 | 0;
if (i == 8 || i == 12 || i == 16 || i == 20) {
uuid += "-"
}
uuid += (i == 12 ? 4 : (i == 16 ? (random & 3 | 8) : random)).toString(16);
}
@kosamari
kosamari / serviceworker.js
Created June 21, 2016 21:22
cache index.html using Service Worker
/*
* CHALLANGE:
* Cache `index.html` file using service worker.
*
* This bit of code is included in <script> tag of index.html
* if (navigator.serviceWorker) {
* navigator.serviceWorker.register('serviceworker.js', {scope: '/'})
* }
*
*/
@Eonasdan
Eonasdan / ComparePlugin.ini
Last active September 28, 2023 13:59
Notepad++ Compare plugin dark mode colors
[Main]
Old is First=1
Old on Left=1
Default Compare is to Prev=1
Go to First Diff=0
Check Encodings=1
Wrap Around=0
Compact NavBar=1
Ignore Spaces=0
Detect Moves=1
@kylebarrow
kylebarrow / example.html
Created June 23, 2011 06:30
Prevent links in standalone web apps opening Mobile Safari
<!DOCTYPE html>
<head>
<title>Stay Standalone</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<script src="stay_standalone.js" type="text/javascript"></script>
</head>
<body>
<ul>
<li><a href="http://google.com/">Remote Link (Google)</a></li>