Skip to content

Instantly share code, notes, and snippets.

View marcolink's full-sized avatar
🪐

Marco Link marcolink

🪐
View GitHub Profile
@particlebanana
particlebanana / set-npmrc.js
Created June 9, 2016 22:56
Script to dynamically build up .npmrc in production
// ╔═╗╦═╗╔═╗╦╔╗╔╔═╗╔╦╗╔═╗╦ ╦ ┌─┐┌─┐┌┬┐ ┌┐┌┌─┐┌┬┐┬─┐┌─┐ ┌─┐┬┬ ┌─┐
// ╠═╝╠╦╝║╣ ║║║║╚═╗ ║ ╠═╣║ ║ └─┐├┤ │ │││├─┘│││├┬┘│ ├┤ ││ ├┤
// ╩ ╩╚═╚═╝╩╝╚╝╚═╝ ╩ ╩ ╩╩═╝╩═╝ └─┘└─┘ ┴ ┘└┘┴ ┴ ┴┴└─└─┘ └ ┴┴─┘└─┘
//
// Used in production to install npm private modules
if(process.env.NODE_ENV !== 'production') {
return;
}
var fs = require('fs');
@manekinekko
manekinekko / regex-es6-imports.js
Last active March 31, 2025 22:46
A regular Expression to parse ECMAScript6 import syntax
let regex = `import
(?:
["'\s]*
([\w*{}\n, ]+)
from\s*
)?
["'\s]*
([@\w/_-]+)
["'\s]*
;?
@PurpleBooth
PurpleBooth / README-Template.md
Last active April 18, 2025 02:49
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@jhohlfeld
jhohlfeld / gist:bc0ed726550192eb183d
Created June 12, 2015 08:10
Run different node.js versions on a Mac using homebrew

I suppose you already installed homebrew nad have one current version of node installed.

Reference taken from https://gist.github.com/kugaevsky/68a7fa894551da9c310a

First, add an older formula of node:

$ cd /usr/local
$ git checkout b64d9b9c431642a7dd8d85c8de5a530f2c79d924 Library/Formula/node.rb
$ brew unlink node
@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active March 24, 2025 20:20
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@yiwenl
yiwenl / JsBlobSaveJson
Last active September 25, 2023 18:35
Javascript using Blob to save json file
var saveJson = function(obj) {
var str = JSON.stringify(obj);
var data = encode( str );
var blob = new Blob( [ data ], {
type: 'application/octet-stream'
});
var url = URL.createObjectURL( blob );
var link = document.createElement( 'a' );
@rodneyrehm
rodneyrehm / gist:40e7946c0cff68a31cea
Last active March 12, 2025 19:23
Diagrams for Documentation

some tools for diagrams in software documentation

Diagrams For Documentation

Obvious Choices

ASCII

@adrianorsouza
adrianorsouza / sublime-command-line.md
Last active September 26, 2023 16:26
launch sublime text from the command line

Launch Sublime Text from the command line on OSX

Sublime Text includes a command line tool, subl, to work with files on the command line. This can be used to open files and projects in Sublime Text, as well working as an EDITOR for unix tools, such as git and subversion.

Requirements

  • Sublime text 2 or 3 installed in your system within Applications folder

Setup

@keyle
keyle / HDD.groovy
Created August 4, 2014 10:34
Groovy. Write objects to file (json) and read them back
package utils
import groovy.json.JsonBuilder
import groovy.json.JsonSlurper
class HDD {
static save(Object content, String filePath) {
new File(filePath).write(new JsonBuilder(content).toPrettyString())
}
@wojciak
wojciak / pixiRetinaResize.js
Created July 3, 2014 20:04
A base implementation of properly handling viewport resize and rotation in PIXI.js (including retina support).
/**
* The width and height to which our graphic assets are designed for
* Keep in mind retina resolutions and remember to provide 2xWidth 2xHeight assets for them
*/
var targetWidth = 1024;
var targetHeight = 768;
/**
* The main (root) container on the stage
* You should always have a master container on your stage