Skip to content

Instantly share code, notes, and snippets.

View axelpale's full-sized avatar

Akseli Palén axelpale

View GitHub Profile
@twilson63
twilson63 / README.md
Created April 29, 2019 15:53
Setup for Frontend Tests - tape - puppeteer - rollup

Testing Front End code

Testing front end code using rollup, tape-modern, and puppeteer.

These are just some notes for me to write down so that I have a good cheatsheet to set this up in the future.

Using rollup to build front end code is the way to go, it is small and provides tree shaking and the plugins are easy to manage. Using rollup to build a test bundle and using puppeteer to run the test bundle will create a chromium head browser and give you similar results as if you are running it in the browser.

Getting started

@mikaelz
mikaelz / php7-lint.sh
Created April 10, 2017 13:15
PHP lint files, for example due migration to PHP7
#!/bin/bash
find . -name '*.php' | xargs -i php -l {} | grep -v 'No syntax errors'
@asheb
asheb / mocha-source-map-reporter.coffee
Created July 20, 2014 09:39
Dirty hack to make 'source-map-support' work with mocha in PhantomJS
sourceMapper = require 'source-map-support'
Dot = require '../../../node_modules/grunt-mocha/node_modules/mocha/lib/reporters/dot.js'
module.exports = Dot
##
parseLine = (line) ->
[_, file, row] = line.match /file:\/\/\/(.*):(\d*)/
frame =
getFileName: -> file
@kylebgorman
kylebgorman / triangle.py
Created December 21, 2013 01:39
Triangular (square) matrix class for Python, using only half as much memory. Supports decent portions of what you'd expect for a numpy object
#!/usr/bin/env python -O
#
# Copyright (c) 2013 Kyle Gorman
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
@branneman
branneman / better-nodejs-require-paths.md
Last active April 11, 2025 10:39
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions