Skip to content

Instantly share code, notes, and snippets.

View kuzmicheff's full-sized avatar

Andre Kuzmicheff kuzmicheff

View GitHub Profile
@coolaj86
coolaj86 / cors.js
Created October 29, 2010 08:37
CORS / XHR2 middleware for Node.js
/*
Here's some documentation on XMLHttpRequest Level 1 and 2 as per the
standard and as per implementation.
XHR
http://www.w3.org/TR/XMLHttpRequest/
http://developer.apple.com/internet/webcontent/xmlhttpreq.html
http://msdn.microsoft.com/en-us/library/ms535874%28VS.85%29.aspx
XHR2
@infusion
infusion / recursive-primitive.js
Last active February 2, 2020 22:10
An implementation of primitive operations like addition, multiplication and so on - recursively!
/**
* @license Recursive-Primitive.js
*
* Copyright (c) 2014, Robert Eisele (robert@xarg.org)
* Dual licensed under the MIT or GPL Version 2 licenses.
**/
const add = (a, b) => b === 0 ? a : add(a + 1, b - 1);
const sub = (a, b) => b === 0 ? a : sub(a - 1, b - 1);
const mul = (a, b) => b === 1 ? a : add(mul(a, b - 1), a);
@Component({
selector: 'add-story-form',
template: `
<div class="container">
<h1>New Story</h1>
<form [formGroup]="newStory"
(submit)="submit($event)"
(success)="onSuccess()"
(error)="onError($event)"
connectForm="newStory">
@alexhawkins
alexhawkins / binaryTree.js
Last active October 16, 2022 20:27
Binary Trees and Tree Traversal
'use strict';
function BinarySearchTree() {
this.root = null;
}
BinarySearchTree.prototype.makeNode = function(value) {
var node = {};
node.value = value;
node.left = null;
.fadeinDown {
-webkit-animation: fadeInDown 500ms ease-in-out; /* Chrome, Safari, Opera */
animation: fadeInDown 500ms ease-in-out;
}
/* Chrome, Safari, Opera */
@-webkit-keyframes fadeInDown {
0% {
@harmancode
harmancode / gist:84c06855907975903583f79dcc67440a
Last active January 13, 2023 22:37
How to fix opendir operation not permitted error from rsync on macOS Catalina
## How to fix opendir operation not permitted error from rsync on macOS Catalina
by Ertugrul Harman (twitter.com/harmancode - github.com/harmancode)
27 Dec 2020
I was getting opendir operation not permitted error from rsync on macOS Catalina.
The command I was using: rsync -vaE --progress /Volumes/SourceName /Volumes/DestinationName
Source: https://apple.stackexchange.com/a/117469/65292
@leemm
leemm / gist:ab82d8bb91f899b3540787155524d776
Last active February 16, 2023 23:25
Installing and configuring nvidia drivers in clean Elementary OS 6.x install, including gamemode and prime-run (if indemand)
To install nvidia drivers (based on 515.48.07 at the time of writing) in a clean elementary os 6.1 Jolnir install. DON'T use the driver listed in the eos store.
// Install the toolchain
sudo apt install build-essential
sudo apt install software-properties-gtk
sudo apt install software-properties-common
sudo apt install linux-headers-$(uname -r)
// Install the drivers
sudo add-apt-repository ppa:graphics-drivers/ppa
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active February 12, 2024 17:18
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@jaysonrowe
jaysonrowe / FizzBuzz.js
Created January 11, 2012 01:39
FizzBuzz JavaScript solution
for (var i=1; i <= 20; i++)
{
if (i % 15 == 0)
console.log("FizzBuzz");
else if (i % 3 == 0)
console.log("Fizz");
else if (i % 5 == 0)
console.log("Buzz");
else
console.log(i);
@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",