Skip to content

Instantly share code, notes, and snippets.

View nitriques's full-sized avatar

Nicolas Brassard nitriques

View GitHub Profile
@nitriques
nitriques / .bash_aliases-ubuntu
Last active June 1, 2019 19:01
My .bash_profile files. OS X, Windows (git bash) and Linux (Ubuntu/Cent OS)
alias l='ls -CF'
alias home='cd ~/'
alias apt-get='aptget'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias o='nautilus .'
alias c='xdg-open'
@nitriques
nitriques / add-missing-lang-image.sql
Last active February 19, 2019 15:57
Multilingual Textbox: add missing lang
ALTER TABLE `sym_entries_data_X`
ADD `file-en` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
ADD `size-en` int(11) unsigned DEFAULT NULL,
ADD `mimetype-en` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
ADD `meta-en` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
@nitriques
nitriques / sync-starter-kit.sh
Last active March 16, 2018 22:54
sync-starter-kit.sh
#!/bin/bash
#function syncsk27 {
# pwd=`pwd`;
# cd /q;
# ./sync-starter-kit.2.7.sh $@;
# cd $pwd;
#}
VERSION=2.3.0
@nitriques
nitriques / import.php
Created June 20, 2014 19:31
Importing data into Symphony-CMS from the command line
<?php
// You run it with php-cli
// i.e. php-cli import.php
// I usually run in on the server via ssh.
// I also usually put my scripts into manifest (to protect them from http access)
// This scripts imports data from a csv...
@nitriques
nitriques / git-config.sh
Last active September 18, 2017 23:10
git config
git config --global user.email nitriques@users.noreply.github.com
git config --global help.autocorrect 1
git config --global color.ui 1
git config --global core.excludesfile ~/.gitignore_global
git config --global apply.whitespace "fix"
git config --global core.abbrev 10 # default is 7, linux uses 12, nodejs uses 10
git config --global rerere.enabled true
git config --global --add alias.lol "log --graph --decorate --pretty=oneline --abbrev-commit"
UPDATE `sym_entries_data_XXX` SET
`file` = `file-fr` ,
`size` = `size-fr` ,
`mimetype` = `mimetype-fr` ,
`meta` = `meta-fr` ,
`file-en` = `file-fr` ,
`size-en` = `size-fr` ,
`mimetype-en` = `mimetype-fr` ,
`meta-en` = `meta-fr` ,
`file-fr` = NULL ,
@nitriques
nitriques / concat.md
Last active October 30, 2016 19:50
How to properly concat js files

That tweet created some responses and since 140 chars is not enough to explain how to do it, I decided to posted here.

First and formost, if not properly done, blindly concatenating javascript files can cause problems and will prevent the rest of your code to execute. This is by design: the js code must halt when it encounters and exception. But there are places (read API) where this rule is encapsulated, meaning that the error will halt only the current stack of execution.

That's the main thing: do not call you code, ever, to run in the first stack execution.

Create simple "module", scoped into an IIFE, which ends with a semi-colon (always)

@nitriques
nitriques / add.js
Created June 30, 2016 02:21
recursive curried adder
'use strict';
var add = function (x) {
var i = function (y) { return add(x + y); };
i.valueOf = function () { return Number(x); };
return i;
};
<?php
require_once(TOOLKIT . '/class.datasource.php');
Class datasourcemonth_calendar extends Datasource {
public $dsParamROOTELEMENT = 'month-calendar';
public $dsParamORDER = 'asc';
public $dsParamREDIRECTONEMPTY = 'no';
#!/bin/sh
for D in ./*; do
if [ -d "${D}" ]; then
cd "${D}"
echo "${D}"
git unpushed
cd ..
fi
done