Skip to content

Instantly share code, notes, and snippets.

Raffi Minassian raffi-minassian

Block or report user

Report or block raffi-minassian

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile



None of the string methods modify this – they always return fresh strings.

  • charAt(pos: number): string ES1

    Returns the character at index pos, as a string (JavaScript does not have a datatype for characters). str[i] is equivalent to str.charAt(i) and more concise (caveat: may not work on old engines).


npm rank

This gist is updated daily via cron job and lists stats for npm packages:

  1. Top 1,000 most depended-upon packages
  2. Top 1,000 packages with largest number of dependencies
  3. Top 1,000 packages with highest PageRank score
hueniverse / gist:a06f6315ea736ed1b46d
Last active Mar 30, 2020
Simple node.js code style tips to improve code quality
View gist:a06f6315ea736ed1b46d

Whether you use 2 spaces or 4 spaces, there are a few simple things that can make your node.js code easier to read. We've been using them in all the hapi modules for over 4 years now to great results. This list is by no means complete but it highlights the most useful elements that will give you immediate value in reducing bugs.

Required modules

JavaScript makes it harder than most languages to know where variables are coming from. Variables assigned required modules are particularly important because they represent a singleton object shared with the entire application. There are also globals and module globals, along with function variables and arguments.

Traditionally, variables starting with an uppercase letter represent a class that must be instantiated using new. This was an important semantic in the early days of JavaScript but at this point, if you don't know Date requires new Date() you are probably very new. We have adopted Upper Camel Case variable names for all module global variables

lelandbatey /
Last active Mar 20, 2020
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!


This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"


substack / dotslashtaskdotjs.markdown
Created Jan 8, 2014
introducing ./task.js, THE new javascript task runner automation framework
View dotslashtaskdotjs.markdown

why ./task.js?

One word: task automation. It's basically zero effort and you can use the ./task.js package manager to handle any repetitive tasks. You can use ./task.js to automate everything with minimum effort.

./task.js provides the structure, order, and authority that you as a developer so desperately crave. ./task.js will also take responsibility for your actions if you need it to. It's what everybody is using now. ./task.js is the new hotness. It's all about ./task.js now, just like that.

This is compared to npm run/bash scripts, which are:

troy / 01papertrail.config
Last active Dec 12, 2015
Aggregate logs from AWS Elastic Beanstalk instances (Java, PHP, Ruby, etc.) to Papertrail without a custom AMI. (DEPRECATED)
View 01papertrail.config
# You probably want one of these newer, better examples:
# Credits:
# Jason Pirkey, Táve Corporation,
# Jeremy Mickelson,
# See
chitan /
Created Jul 7, 2012
How to use WebSocket of Tomcat
//This sample is how to use websocket of Tomcat.
package wsapp;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.util.ArrayList;
import org.apache.catalina.websocket.MessageInbound;
import org.apache.catalina.websocket.StreamInbound;
import org.apache.catalina.websocket.WebSocketServlet;
# This script installs and configures couchdb on a fresh Amazon Linux AMI instance.
# Must be run with root privileges
# Tested with Amazon Linux AMI release 2011.02.1.1 (ami-8c1fece5)
export BUILD_DIR="$PWD"
# NOTE: this is an OSX launchd wrapper shell script for Tomcat (to be placed in $CATALINA_HOME/bin)
function shutdown() {
echo "Shutting down Tomcat"
$CATALINA_HOME/bin/ stop
You can’t perform that action at this time.