Skip to content

Instantly share code, notes, and snippets.

linkin-park /
Created Apr 29, 2020 — forked from joepie91/
Getting started with Node.js

"How do I get started with Node?" is a commonly heard question in #Node.js. This gist is an attempt to compile some of the answers to that question. It's a perpetual work-in-progress.

And if this list didn't quite answer your questions, I'm available for tutoring and code review! A donation is also welcome :)

Setting expectations

Before you get started learning about JavaScript and Node.js, there's one very important article you need to read: Teach Yourself Programming in Ten Years.

Understand that it's going to take time to learn Node.js, just like it would take time to learn any other specialized topic - and that you're not going to learn effectively just by reading things, or following tutorials or courses. _Get out there and build things!

View util.js
(function($) {
* Generate an indented list of links from a nav. Meant for use with panel().
* @return {jQuery} jQuery object.
$.fn.navList = function() {
var $this = $(this);
$a = $this.find('a'),
View CSVProcessor
package com.detector;
import java.util.ArrayList;
import java.util.List;
public class CSVProcessor {
final String doubleQuoteRegex = "^\"\".*";
private String[] process(String buffer) {
List<String> values = new ArrayList<String>();
View Makefile
# Hello, and welcome to makefile basics.
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
# Once you're done here, go to
# to learn SOOOO much more.
View Error
module.exports = {
// The absolute path to your project
context: __dirname + "/",
// the entry point for our app
entry: './main.js',
// where to put the compiled output (what our script tag will link to)
output: {
// where does it go?
path: __dirname + "/",
// what is the file called?
linkin-park / Hello React
Created Oct 16, 2017
Error: HelloC.render(): A valid React element (or null) must be returned. You may have returned undefined, an array or some other invalid object.
View Hello React
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<script src=""></script>
<script src=""></script>
<div id="app"></div>
linkin-park /
Created Oct 13, 2017 — forked from gunjanpatel/
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}'

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

View Erlang
main() ->
Arr = read_2darray(6,6,"~d"),
%taken in reverse order
read_array(0,_) -> [];
View Erlang - Medium
% Enter your code here. Read input from STDIN. Print output to STDOUT
% Your class should be named solution
main() ->
{ok,[N,K]} = io:fread("","~s~d"),
P = ktimes(N,K,""),
{Num,_} = string:to_integer(P),