Skip to content

Instantly share code, notes, and snippets.

@netpoetica
netpoetica / Setting up Nginx on Your Local System.md
Last active February 25, 2024 02:45
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 / Clevar.js
Last active December 21, 2015 05:49
Clevar constructs an accessor function that retains its own History Store and keeps the value absolutely private. Neat utility for tracking history of a variable over time.
var Clevar = function(value){
// Constructs an accessor function that retains its own History Store.
var _this = this;
var _history = []; // Indexable history (newest to oldest)
// Define static objects, only the first time Clevar is run.
Clevar.Record = Clevar.Record || function(value){
this.created = new Date();
this.value = value;
};
@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 / .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'
<div id="consolelog" style="font-family: 'Courier New', Courier, monospace; font-size: 12px; margin: 40px 30px 0px; background-color: white; border: 2px solid black; padding: 10px;"></div>
<input type="text" id="consoleinput" style="margin: 0px 30px; width: 400px;" onkeypress="return evalConsoleInput(event, this.value);" />
<script type="text/javascript">
var appendConsole = function(message, type) {
var color = "black";
if (type === "error") {
color = "red";
} else if (type === "debug") {
@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 / indexOfAll.js
Created June 8, 2014 18:52
Return the index of all instances of an item in an String
String.prototype.indexOfAll = function(s){
// Make sure it's 1 char, use first char of string.
s = s[0];
var results = [],
result = null,
i = 0,
offset = 0, // Incremented by previous index
@netpoetica
netpoetica / enumerate.js
Last active August 29, 2015 14:03
enumerate - decompose an array for iteration in a for...in
/*
Usage
// You have an array
var myArr = ["a", 'b', "c"];
// You want to enumerate through it w/ specified index. If you enumerate
// through an array by default index cannot be "guaranteed" as per MSDN:
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...in
// for..in should not be used to iterate over an Array where index order is important. Array indexes are just enumerable properties with integer names and are otherwise identical to general Object properties. There is no guarantee that for...in will return the indexes in any particular order and it will return all enumerable properties, including those with non–integer names and those that are inherited.
@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 / SupplementToRedemptionFromCallbackHell
Created July 15, 2014 23:45
An Example of Why Promises and Generators are Important
// An Example of Why Promises and Generators are Important
// Based on this awesome video: https://www.youtube.com/watch?v=hf1T_AONQJU
// You can just copy and paste this code into your console to see it in action
var App = function App(){
// Named anonymous functions for clear picture
// of the call stack in the error stack trace
this.asyncError = function myAsynchronousError(){
throw new Error('Asynchronous error');