Skip to content

Instantly share code, notes, and snippets.

View heyarne's full-sized avatar

heyarne

View GitHub Profile
@heyarne
heyarne / bower.json
Last active August 29, 2015 13:56
Basic setup for using Curl.js to load commonjs modules; useful for testing modules written for browserify. Used modules can be installed with `bower install`
{
"name": "Curljs cjsm11 setup",
"private": true,
"dependencies": {
"chai": "~1.8.0",
"mocha": "~1.14.0",
"curl": "~0.8.8",
"backbone": "~1.1.0",
"zepto": "~1.1.2",
"lodash": "~2.4.1"
@heyarne
heyarne / overflow-cause-finder.js
Last active August 29, 2015 14:11
Find elements too wide for a viewport, causing horizontal scrollbars (jQuery necessary)
(function ($) {
var bodyWidth = $(document.body).outerWidth();
var $elems = $('body *').filter(function () {
var $this = $(this)
return $this.offset().left + $this.outerWidth(true) - parseInt($this.css('margin-left'), 10) > bodyWidth
})
if ($elems.length)
console.log($elems)
else
@heyarne
heyarne / koel-s3-storage.md
Last active October 27, 2018 00:47
How to use Amazon S3 with koel

How to use Amazon S3 for storing your koel media files

In this short tutorial I will show you a (kind of hacky, but working) option to set up your koel instance so that you can store your media files on S3 as provided by Amazon. I will also share some of the insights and experiences I had with the setup. Be aware that it's not officially supported and it might work differently to from what you expect. I myself have not had the setup running for a very long time yet. Feel free to share your thoughts in the comments below or add to the document.

If you feel like supporting me, maybe use my Digital Ocean referral link when signing up. If you do that, please also support the original authors of the various tools. They did the hard work, I just glued it together.

Basic setup

@heyarne
heyarne / index.js
Created July 21, 2016 10:34
requirebin sketch
var Chance = require('chance')
var chance = new Chance()
// how many rows should be generated?
const amount = 100
// define all of the required fields in the form [[ $title1, $type1 ], [ $title2, $type2, $args2 ] ... ]
// $typeN maps to one of the functions exposed by the [chance api](http://chancejs.com/) (for example 'street' or 'email')
const stencil = [
[ 'Firma', 'word' ],
@heyarne
heyarne / README.md
Last active August 23, 2018 09:59
Get a random free port on uberspace

Setup instructions

Use ssh to login to your uberspace account, then:

$ wget -O free-port https://gist.githubusercontent.com/heyarne/9a6325149f765151bbcceb26a835dade/raw/1f07b69e62f0c47423acb5cb912482b7d65940f0/free-port.sh
$ chmod +x free-port
$ mv free-port ~/bin
$ free-port
$ # example output: 64477
@heyarne
heyarne / build.gradle
Created February 3, 2017 13:40
Android build version with git commit hash
// merge this with your current build.gradle
// generates a version name from currently checked out git commit
def getCommitHash = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@heyarne
heyarne / test-output.txt
Created December 12, 2017 10:18
fiona test output
============================= test session starts ==============================
platform darwin -- Python 2.7.10, pytest-3.3.1, py-1.5.2, pluggy-0.6.0
rootdir: /Users/heyarne/tmp/Fiona, inifile:
plugins: cov-2.5.1
collected 605 items
tests/test_bigint.py . [ 0%]
tests/test_bounds.py .... [ 0%]
tests/test_bytescollection.py FFFFFFFFFFsFFFFFFFFFFFFFFFFFFFFFFFFFFF. [ 7%]
tests/test_collection.py ............................................... [ 15%]
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
server {
listen 80;
listen [::]:80;
server_name my.server.address;
# enforce https
return 301 https://$server_name$request_uri;
# index index.html;
}
server {