Skip to content

Instantly share code, notes, and snippets.

@netpoetica
netpoetica / Setting up Nginx on Your Local System.md
Last active April 22, 2024 04:25
Setting up Nginx on Your Local System

#Setting up Nginx on Your Local System ###by Keith Rosenberg

##Step 1 - Homebrew The first thing to do, if you're on a Mac, is to install homebrew from http://mxcl.github.io/homebrew/

The command to type into terminal to install homebrew is:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@netpoetica
netpoetica / ImportSVGToSymbol.html
Created January 8, 2013 05:06
In Paper.js, use importSVG to import an svg node to a useable symbol and remove it from the DOM.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Paperjs - ImportSVG to Symbol</title>
<script type="text/javascript" src="js/lib/paper.js"></script>
<script type="text/paperscript" canvas="canvas">
function SVGSymbol(elem){
var a = new Symbol(paper.project.importSvg(elem));
elem.parentNode.removeChild(elem);
@netpoetica
netpoetica / Singleton.js
Created August 20, 2012 01:36
A Singleton in JavaScript that truly ensures one instance, can be lazy-loaded (you can instantiate it whenever you need it), and has private and public scope.
/* **
*
* Singleton.js - a true Singleton in JavaScript
*
* A Singleton in JavaScript that truly ensures one instance, can be lazy loaded / you
* can instantiate it whenever you need it and has private and public scope.
*
* @author Keith Rosenberg, netPoetica
*
* */
@netpoetica
netpoetica / Compiling v8 and Hello, World Example on Mac OSX Mavericks (10.9.4).md
Last active August 7, 2022 09:25
Compiling v8 and Hello, World Example on Mac OSX Mavericks (10.9.4), Link Clang to Static Libraries, properly configure your environment for v8 build

Compiling v8 and Hello, World Example on Mac OSX Mavericks (10.9.4)

by Keith Rosenberg (netpoetica)

Note: do this in some sort of project/ directory that makes sense. depot_tools are going to need to be in your path, so you may want to install them somewhere you are comfortable with.

1) Get the v8 source

git clone https://github.com/v8/v8.git

2) Install depot tools

@netpoetica
netpoetica / machine.js
Created November 29, 2020 18:10
Generated by XState Viz: https://xstate.js.org/viz
const fetchMachine = Machine({
id: 'game',
initial: 'initialize',
context: {
currentActor: undefined,
enemy: undefined,
player: undefined
},
states: {
initialize: {
@netpoetica
netpoetica / ios-select-fix.css
Last active March 28, 2020 00:09
iOS Disable User Select but Allow Input (Snippet)
/*
This is for demonstration purposes. Ideally, you should never use the star selector.
I recommend that you use this early on in your development, and then once you've established
your HTML element palette, go back and replace * with a comma-separated list of your
tag names. Additionally, the !important shouldn't have to be used, but I'm leaving it here
because some enterprising goons will probably copy and paste this directly into their project -
the !important will ensure these settings override other attempts that were either never
deleted or are part of an installed CSS file the user is unaware of.
*/
* {
@netpoetica
netpoetica / .alias
Last active October 2, 2019 19:13
Terminal aliases
alias g="git"
alias cleanup="find . -type f -name '*.DS_Store' -ls -delete"
alias tree="ls -alR"
alias psef= "ps -ef | grep $1"
alias printports="lsof | grep TCP "
alias devtoolscss="cd ~/Library/Application\ Support/Google/Chrome/Default/User\ StyleSheets/"
alias python3='nocorrect python3'
alias pip3='pip-3.3'
alias cltdr="ls -R | grep \":$\" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'"
alias qserve='python -m SimpleHTTPServer'
@netpoetica
netpoetica / .gitconfig
Last active October 2, 2019 19:13
.gitconfig - Be sure to change the information in the [user] section to your username! A lot of this came from all over the WWW, including from the maestro @iansheridan
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
@netpoetica
netpoetica / Switch Case is Not the JS Way
Last active January 13, 2018 08:26
Use functions + dictionary instead of Switch/Case (illustrative purposes)
// Setup
function onGet(){ /* .. */ }
function onDelete(){ /* .. */ }
function onPost(){ /* .. */ }
var onPut = onPost; // Sharing functionality.
// Bad
function processRequest(method){
var requestMethod = method.toLowerCase();
function bubbleSort (arr) {
var left,
right,
swapped;
do {
swapped = false;
for (var i = 0; i < arr.length - 1; i++) {
left = arr[i];
right = arr[i + 1];