Skip to content

Instantly share code, notes, and snippets.

View nitriques's full-sized avatar

Nicolas Brassard nitriques

View GitHub Profile
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
@nitriques
nitriques / memcached.sh
Last active November 19, 2015 16:24
Memcached on Centos 6
# php memcached
# from: http://stackoverflow.com/questions/24407095/error-when-installing-pecl-memcached/30898513#30898513
# Step 1 - Install SASL:
yum install cyrus-sasl-devel
# Step 2 - Compile libmemcached with SASL installed:
cd ~
#!/bin/bash
git clone git@github.com:symphonycms/symphony-2.git bundle
cd bundle
git checkout bundle
cd extensions
pwd
git submodule init
git submodule update
echo ""
@nitriques
nitriques / data.twitter.php
Created June 23, 2015 20:03
Twitter Remote Data Source for Symphony CMS
<?php
require_once(EXTENSIONS . '/remote_datasource/data-sources/datasource.remote.php');
Class datasourcetwitter extends RemoteDatasource {
public $dsParamROOTELEMENT = 'twitter';
public $dsParamURL = 'https://api.twitter.com/1.1/statuses/user_timeline.json?include_entities=true&include_rts=true&screen_name=ACCOUNT_NAME&count=10';
public $dsParamFORMAT = 'json';
public $dsParamXPATH = '/';
@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 / jquery.velocity.js
Last active August 29, 2015 14:10
Polyfill jQuery animations with Velocity
// polyfill jQuery animation engine
$.fn.animate = $.fn.velocity;
$.fn.fadeTo = function (duration, opacity, complete) {
return this.velocity({opacity: opacity}, { duration: duration, complete: complete });
};
$.fn.fadeIn = function (duration, complete) {
return this.velocity('fadeIn', { duration: duration, complete: complete });
};
$.fn.fadeOut = function (duration, complete) {
return this.velocity('fadeOut', { duration: duration, complete: complete });