Skip to content

Instantly share code, notes, and snippets.

View glebec's full-sized avatar
🥃
Slàinte

Gabriel Lebec glebec

🥃
Slàinte
View GitHub Profile
@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

@animatedlew
animatedlew / patternMatch.hs
Last active February 4, 2023 12:32
Here are some examples of pattern matching in Haskell.
-- Haskell will match starting at the top, until it hits a catchall
factorial :: Int -> Int
factorial 0 = 1
factorial n = n * factorial(n - 1)
-- Haskell is able to match empty lists and x:xs patterns
head' :: [a] -> a
head' [] = error "No head available on empty lists!"
head' (x:_) = x
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
var onError = function (err) {
gutil.beep();
console.log(err);
};
gulp.task('styles', function () {
gulp.src('scss/style.scss')
.pipe(plumber(onError)
.pipe(rubysass())
.pipe(gulp.dest('dist/'));
@cletusw
cletusw / .eslintrc
Last active February 29, 2024 20:24
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@Avaq
Avaq / combinators.js
Last active May 19, 2024 00:21
Common combinators in JavaScript
const I = x => x
const K = x => y => x
const A = f => x => f (x)
const T = x => f => f (x)
const W = f => x => f (x) (x)
const C = f => y => x => f (x) (y)
const B = f => g => x => f (g (x))
const S = f => g => x => f (x) (g (x))
const S_ = f => g => x => f (g (x)) (x)
const S2 = f => g => h => x => f (g (x)) (h (x))
@odedw
odedw / .eslintrc.yaml
Last active March 8, 2022 05:27 — forked from cletusw/.eslintrc
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
# http:#eslint.org/docs/rules/
ecmaFeatures:
binaryLiterals: false # enable binary literals
blockBindings: false # enable let and const (aka block bindings)
defaultParams: false # enable default function parameters
forOf: false # enable for-of loops
generators: false # enable generators
objectLiteralComputedProperties: false # enable computed object literal property names
objectLiteralDuplicateProperties: false # enable duplicate object literal properties in strict mode
objectLiteralShorthandMethods: false # enable object literal shorthand methods
@queerviolet
queerviolet / .gitignore
Last active January 18, 2018 17:32
A little calculator
node_modules
@collin
collin / 1-vimsetup.md
Last active August 4, 2017 17:47
Collin's vim setup

I use neovim, which is mostly compatible with all vim plugins and apis.

vim-pathogen loads my plugins

I use a few plugins to give me a better editing/navigation experience.

  • ctrlp.vim fuzzy-search to find files in the project by name
  • nerdtree file tree navigator
  • syntastic syntax highlighting and linting
  • vim-better-whitespace cleans up whitespace as I save files