Skip to content

Instantly share code, notes, and snippets.

View dag0310's full-sized avatar

Daniel Geymayer dag0310

View GitHub Profile
@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
@sinclairtarget
sinclairtarget / bernoulli.c
Created August 17, 2018 20:22
Lovelace's Note G Program in C
#include <stdio.h>
/*
* Calculates what Ada Lovelace labeled "B7", which today we would call the 8th
* Bernoulli number.
*/
int main(int argc, char* argv[])
{
// ------------------------------------------------------------------------
// Data
@adnan360
adnan360 / https-on-localhost.md
Last active May 6, 2024 07:45
Use HTTPS on Localhost (XAMPP, Windows)

Sometimes some websites require https to work. This can be useful in those cases.

This has been tested with XAMPP (PHP 7.0.8) on Windows 7. Please see the Reference links at the end if in confusion about some step.

STEP 1: Editing Configs

Open:

C:\xampp\php\php.ini
@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
@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.

@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: '/'})
* }
*
*/
@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));
};
@tedmiston
tedmiston / nodejs-tcp-example.js
Last active February 19, 2024 21:55
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');