Skip to content

Instantly share code, notes, and snippets.

View JohannesFischer's full-sized avatar

Johannes Fischer JohannesFischer

View GitHub Profile
@JohannesFischer
JohannesFischer / npm.sh
Last active September 6, 2016 01:24
Useful npm commands
# Go to package repo page
npm repo $package
# Go to package home page
npm home $package
# List outdated packages
npm outdated
# Remove extraneous packages
@JohannesFischer
JohannesFischer / snippets.cson
Last active October 6, 2016 02:43
My Atom Snippets
# Your snippets
#
# Atom snippets allow you to enter a simple prefix in the editor and hit tab to
# expand the prefix into a larger code block with templated values.
#
# You can create a new snippet in this file by typing "snip" and then hitting
# tab.
#
# An example CoffeeScript snippet to expand log to console.log:
#
@JohannesFischer
JohannesFischer / RegEx
Last active February 17, 2017 02:39
RegEx I think I will use again
# CSS
# add missing semicolon to last property
([^;])$(\n})
$1;$2
# Shorten hex color values
#([\da-f])\1([\da-f])\2([\da-f])\3\b
#$1$2$3
@JohannesFischer
JohannesFischer / javascript.json
Last active February 23, 2017 02:04
VS Code Snippets [javascript]
{
"Print to console": {
"prefix": "conl",
"body": [
"console.log($1);"
],
"description": "Log output to console"
},
"Print info to console": {
"prefix": "coni",
@JohannesFischer
JohannesFischer / docker.sh
Last active November 7, 2017 00:50
Docker - Remove all untagged Images
docker image rm --force $(docker image ls | awk '$1 == "<none>" {print $3}')
@JohannesFischer
JohannesFischer / userscript.js
Created November 27, 2017 02:30
e-learning
console.log('E-Learning Boost Activated');
let initialized = false;
function getAnswerWindow() {
let win = window;
while (win.window.length > 0) {
win = win.window[1];
}
return win;
@JohannesFischer
JohannesFischer / pre-commit
Last active December 6, 2017 23:48
Git pre commit hook - test modified files with ESLint and Rubocop and for focus tags in spec files
#!/bin/sh
FILE_COUNT=$(git status | grep 'modified:' | wc -l)
if [ $FILE_COUNT -gt 100 ] ; then
echo "File count is 100+, skipping pre-commit validation"
exit 0
fi
FAILED=0
@JohannesFischer
JohannesFischer / swap.js
Last active January 13, 2018 06:43
determine if an array is sortable with one swap
// test arrays
var x = [1, 2, 3];
var y = [1, 3, 2];
var z = [3, 2, 1];
// global swap counter
var swaps = 0;
// custom sort function that counts swaps
function swapcount(a, b){
@JohannesFischer
JohannesFischer / Dockerfile
Created January 30, 2018 07:12
Docker Mongo Node
FROM node:latest
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json /usr/src/app/
RUN npm install
COPY . /usr/src/app
EXPOSE 8000
CMD [ "npm", "start" ]
{"docs":"css/d3~4/docker~17/dom/dom_events/eslint/express/git/html/http/javascript/moment/mongoose/node/npm/ruby~2.3/rails~4.1/sinon~4/webpack"}