Skip to content

Instantly share code, notes, and snippets.

View axelpale's full-sized avatar

Akseli Palén axelpale

View GitHub Profile
@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 27, 2024 04:16
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