Skip to content

Instantly share code, notes, and snippets.

View HoverBaum's full-sized avatar
🌳
 I like 🌳🌳🌳 

Hendrik HoverBaum

🌳
 I like 🌳🌳🌳 
View GitHub Profile
@HoverBaum
HoverBaum / hideScrollbar.less
Created June 1, 2016 01:42
Atom: hide scrollbars
/*
Hide scrollbars when not hovering container in Atom.
For Windows especially.
Get those scrollbars out of your way.
Put this in your 'style.less'.
Open Settings click 'Open config folder'
This was really getting to me, thanks for
@HoverBaum
HoverBaum / modular-headers.styl
Created June 23, 2016 01:43
Calculate modular scalled font-sizes for headlines in Stylus
/*
Calculate modular scalled font-sizes for headlines in Stylus
"Modular scale refers to a series of harmonious numbers
that relate to one another in a meaningful way."
Inspired after reading http://typographyhandbook.com/#font-sizing
Build after http://www.modularscale.com/
*/
@HoverBaum
HoverBaum / JSSyntax.js
Last active June 23, 2016 06:51
An example of JavaScript syntax for code highlighters.
/*
This file is build to have somehting to paste into code highlighters or editors and see how they display JavaScript.
It therefor includes many random things you might do in JS.
*/
function hello() {
var hello = 'hello'
let world = "world"
const helloWorld = hello + ` ${world}`
return(helloWorld)
@HoverBaum
HoverBaum / findFiles.js
Created July 4, 2016 02:22
Asynchronously find all files matching a filter in a directory using node.
/**
* Walks a filestructure starting from a given root and returns all found files to a callback, using a filter.
* @param {String} dir - Root directory
* @param {RegEx} filter - RegEx to test found files against
* @param {Function} done - Callback will be called with (err, foundFiles)
* @private
*/
function walk(dir, filter, done) {
var results = [];
fs.readdir(dir, function(err, list) {
@HoverBaum
HoverBaum / webpack.config.js
Created July 19, 2016 07:43
Basic webpack file for ReactJS based proejcts.
const path = require('path')
const webpack = require('webpack')
module.exports = {
entry: {
main: "./src/js/index.js"
},
output: {
path: path.join(__dirname, 'build', 'js'),
filename: "[name].js"
@HoverBaum
HoverBaum / loggingMiddleware.js
Created July 20, 2016 02:40
Logging middleware for Redux.
/*
Logging middleware for Redux as suggested by the official documentation.
http://redux.js.org/docs/advanced/Middleware.html
*/
export const logger = store => next => action => {
console.log('dispatching\n', action)
let result = next(action)
console.log('next state\n', store.getState())
return result
@HoverBaum
HoverBaum / .travis.yml
Created August 11, 2016 03:19
Deploy Hexo blog using Travis.
# Deploy hexo site by travis-ci
# https://github.com/jkeylu/deploy-hexo-site-by-travis-ci
# LICENSE: MIT
#
# 1. Copy this file to the root of your repository, then rename it to '.travis.yml'
# 2. Replace 'YOUR NAME' and 'YOUR EMAIL' at line 29
# 3. Add an Environment Variable 'DEPLOY_REPO'
# 1. Generate github access token on https://github.com/settings/applications#personal-access-tokens
# 2. Add an Environment Variable on https://travis-ci.org/{github username}/{repository name}/settings/env_vars
# Variable Name: DEPLOY_REPO
@HoverBaum
HoverBaum / bestCommentEver.js
Last active August 25, 2016 02:06
Ever write utterly horrible code? Put this at the top!
/*
, ,
/ \/ \
(/ //_ \_
.-._ \|| . \
\ '-._ _,:__.-"/---\_ \
______/___ '. .--------------------'~-'--.)__( , )\ \
`'--.___ _\ / | Here ,' \)|\ `\|
/_.-' _\ \ _:,_ Be Dragons " || (
.'__ _.' \'-/,`-~` |/
@HoverBaum
HoverBaum / travis-example.yml
Last active April 18, 2017 16:40
Travis config to deploy a Hexo based site using FTP.
# FTP deploy Hexo based site using Travis-ci.org
# https://gist.github.com/HoverBaum/524528aec1032b29669fe9cc82dba066
#
# 1. Copy this file to the root of your repository, then rename it to '.travis.yml'
# 2. Replace 'YOUR NAME' and 'YOUR EMAIL'
# 3. Create "Environment Variables" in travis. Make sure to not show them in the output.
# - FTP_USER: The username for FTP transfer.
# - FTP_PASSWORD: Password for the user.
# 4. Replace "DOMAIN.TLD" with your FTP domain and maybe the path where to put things.
#
@HoverBaum
HoverBaum / example.js
Created April 28, 2017 16:50
Illustrating JS template string for HTML templating.
const numbers = [1, 2, 3, 4]
const list = html`
<ul>
${numbers.map(number => `<li>${number}</li>`)}
</ul>`
/*
At this point we have:
<ul>