Skip to content

Instantly share code, notes, and snippets.

View mieky's full-sized avatar
🦀

Mike Arvela mieky

🦀
View GitHub Profile
@chesles
chesles / d3.linechart.js
Created May 31, 2013 18:40
Reusable line chart using d3.chart
function getter(attr, scale) {
return function(d) {
return scale ? scale(d[attr]) : d[attr]
}
}
var defaults = {
width: 560,
height: 250,
x: 'x',
@nnarhinen
nnarhinen / index.html
Created August 9, 2013 07:42
POST Form to new window and wait for postMessage
<html>
<head>
<title>Post form in a new window without losing handle to the window</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
$(function() {
$('form').on('submit', function(ev) {
var form = $(this);
form.attr('target', 'new-window');
@jareware
jareware / gist.md
Last active January 30, 2024 03:15
Project-specific lint rules with ESLint

⇐ back to the gist-blog at jrw.fi

Project-specific lint rules with ESLint

A quick introduction

First there was JSLint, and there was much rejoicing. The odd little language called JavaScript finally had some static code analysis tooling to go with its many quirks and surprising edge cases. But people gradually became annoyed with having to lint their code according to the rules dictated by Douglas Crockford, instead of their own.

So JSLint got forked into JSHint, and there was much rejoicing. You could set it up to only complain about the things you didn't want to allow in your project, and shut up about the rest. JSHint has been the de-facto standard JavaScript linter for a long while, and continues to do so. Yet there will always be things your linter could check for you, but doesn't: your team has agreed on some convention that makes sense for them, but JSHint doesn't have an option

@nnarhinen
nnarhinen / deploy.bash
Last active December 31, 2015 12:28
My deployment script to pull and run a docker-contained clojure web application
id=$(docker ps | grep myimage:latest | awk '{ print $1 }')
docker pull quay.io/nnarhinen/myimage
new_id=$(docker run -d -p 3000 \
-e ENVIRONMENT=PRODUCTION quay.io/nnarhinen/myimage)
id=$new_id ./update-nginx-port.bash
docker stop $id
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 10, 2025 09:21
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

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:

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

Results

@kimmobrunfeldt
kimmobrunfeldt / 0-osx-for-web-development.md
Last active July 26, 2022 13:30
Install web development tools to Mavericks (OS X 10.9)

Install web development tools to Mavericks (OS X 10.9)

Strongly opinionated set of guides to quickly setup OS X Mavericks for web development. By default OS X hides stuff that normal people don't need to see. These settings are better defaults for developers.

I don't want: any sounds, annoying confirmation dialogs, hidden extensions, superflous animations, unnecessary things running like Dashboard, Notification center or Dock(Alfred/spotlight works better for me).

These are my opinions. Read this document through and pick up the good parts to your preferences.

System preferences

@staltz
staltz / introrx.md
Last active April 24, 2025 06:10
The introduction to Reactive Programming you've been missing
@ilkka
ilkka / .zshrc
Created June 25, 2014 07:35
Linux / Mac battery level in zsh right side prompt
...
if [[ -r $HOME/.zshstuff/batterylevel.py ]]; then
RPROMPT="$RPROMPT $(python $HOME/.zshstuff/batterylevel.py)"
fi
# Bonus! Indicator of stopped (^Z'd) jobs
function stopped_jobs(){
if [[ "$(jobs)" =~ "suspended" ]]; then
@arielsalminen
arielsalminen / config.cson
Last active August 29, 2015 14:05
My Atom editor settings, preview: https://dl.dropboxusercontent.com/u/2206960/atom.jpg In addition you’ll need the following free fonts: "Input Mono Regular" & "Input Sans Regular" from http://input.fontbureau.com/download/
'editor':
'lineHeight': 1.45
'softWrap': true
'normalizeIndentOnPaste': true
'tabLength': 2
'preferredLineLength': 100
'invisibles':
'cr': '↩'
'eol': ''
'space': '·'
@anttti
anttti / gist:a387fa2c87b34de5d9f8
Last active August 29, 2015 14:11
Basic Gulp config with livereload, sass, autoprefix, server
var gulp = require('gulp');
var sass = require('gulp-sass');
var webserver = require('gulp-webserver');
var livereload = require('gulp-livereload');
var autoprefixer = require('gulp-autoprefixer');
var del = require('del');
gulp.task('clean', function (cb) {
del(['dist/**'], cb);
});