Skip to content

Instantly share code, notes, and snippets.

View sixertoy's full-sized avatar
🏠
Working as #digital #nomad

Matthieu sixertoy

🏠
Working as #digital #nomad
  • Available for React Jobs
  • Montpellier - France
View GitHub Profile
@sixertoy
sixertoy / windows-console-help.md
Last active August 29, 2015 14:05
Windows Console Help
@sixertoy
sixertoy / console-stacktrace
Created August 30, 2014 20:10
console-stacktrace
function __getErrorObject(){
var obj = {};
var err = (new Error).stack.split("\n");
err = err.splice(1);
// [0].match(/:([0-9]+):/)[1];
return err;
}

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:

var Article = require('../../../models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@sixertoy
sixertoy / multiple_accounts_github.md
Last active August 29, 2015 14:10
Multiple Github Accounts

Remove SSH Key

ssh-add -D

List SSH Key

ssh-add -l
/* ===========================================================
* bootstrap-tooltip.js v2.2.2
* http://twitter.github.com/bootstrap/javascript.html#tooltips
* Inspired by the original jQuery.tipsy by Jason Frame
* ===========================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@sixertoy
sixertoy / mysql_truncate_fk
Created February 17, 2015 10:03
MySQL Truncate With Foreign Keys
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE table1;
TRUNCATE table2;
SET FOREIGN_KEY_CHECKS=1;
@sixertoy
sixertoy / foreach-loop.less
Last active February 27, 2016 08:31
Less-curious Loop For Each Example
.socials {
@names: facebook, instagram, rss, twitter;
.icon{
width: 24px;
height: 24px;
display:block;
overflow: hidden;
text-indent: -9999px;
background: url(../images/socials_icons_24x24.png) no-repeat 0 0 transparent;
@sixertoy
sixertoy / .bash_profile
Last active April 14, 2016 09:30
Commands + Bash profile
# -----------------------------------
#
# GIT Functions
#
function git-name {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function git-desc {
branch=$(git rev-parse --abbrev-ref HEAD)
@sixertoy
sixertoy / README.md
Last active February 28, 2018 07:09
JS Console Utils

JS Console Utils

  • Percent preloader
  • Colors in console
#!/usr/bin/env node
/**
*
* Git COMMIT-MSG hook for validating commit message
*
* To be validated commit's message requires:
* - A '#' at message begining
* - Uppercase chars afer '#'
* - Digit chars afer uppercase chars