Skip to content

Instantly share code, notes, and snippets.

View mlutfy's full-sized avatar

Mathieu Lu mlutfy

View GitHub Profile
@mlutfy
mlutfy / create-platform.sh
Created December 28, 2016 16:31
create-platform.sh
#!/bin/bash
# We try to find the latest release when possible.
CIVICRM_VERSION=`php -r '$versions = json_decode(file_get_contents("https://latest.civicrm.org/versions.json")); $last = array_pop($versions->{4.6}->releases); print $last->version;'`
CKEDITOR_VERSION="4.5.6"
# http://drupal.stackexchange.com/questions/133925/find-latest-drupal-version-number/133948#133948
# (and remove spaces)
DRUPAL_MAJOR="7"
DRUPAL_VERSION=`drush pm-releases drupal-${DRUPAL_MAJOR} --fields=Release --field-labels=0 | grep -v dev | grep 7. | awk '{print $1}'`
@mlutfy
mlutfy / package.json
Created December 6, 2016 14:20
symbiobot package.json
{
"name": "symbiobot",
"version": "0.0.0",
"private": true,
"author": "mathieu <mathieu@symbiotic.coop>",
"description": "Assistant SymbioTIC",
"dependencies": {
"hubot": "^2.18.0",
"hubot-diagnostics": "0.0.1",
"hubot-google-images": "^0.2.6",
/*
Description:
CiviCRM contact search
Configuration:
see ../config/civicrm.js (shared with civicrm-timetrack.js).
https://gist.github.com/mlutfy/b452f628bd79103a98283c48a2a39770
Commands:
!pi [...]
#!/bin/sh
#
# Check the signal levels from connected Wi-Fi stations
#
# Usage: check_batsignal [interface]
#
# TODO: does not support critical/warning. Only used for perfdata.
# See check_bandwidth for examples.
#
# Based on the bat-signal Réseau Libre script by Philippe Gauthier.
@mlutfy
mlutfy / gist:193ca921fe281ce33a868d40f0c0ee9c
Created October 18, 2016 19:17
civicrm "select some" custom search
diff --git a/civicrm/CRM/Contact/Selector.php b/civicrm/CRM/Contact/Selector.php
index 38af9ea..da0db2a 100644
--- a/sites/all/modules/civicrm/CRM/Contact/Selector.php
+++ b/sites/all/modules/civicrm/CRM/Contact/Selector.php
@@ -1054,7 +1054,14 @@ INSERT INTO civicrm_prevnext_cache ( entity_table, entity_id1, entity_id2, cache
SELECT DISTINCT 'civicrm_contact', contact_a.id, contact_a.id, '$cacheKey', contact_a.display_name
";
- $sql = str_replace($replaceSQL, $insertSQL, $sql);
+ // [ML] JVILLAGE redmine:745 Make it possible to have cutom searches that
@mlutfy
mlutfy / gist:c5d57cd8088b24a7ce9995c82455b891
Last active September 27, 2016 13:37
CiviCRM i18n API test
civicrm_api3('Setting', 'create', [
'lcMessages' => 'en_US',
'languageLimit' => [
'en_US' => 1,
],
]);
CRM_Core_I18n_Schema::makeMultilingual('en_US');
global $dbLocale;
var settings = {}
settings.civicrm = {},
settings.civicrm.server = "https://crm.example.coop",
settings.civicrm.path = "/sites/all/modules/civicrm/extern/rest.php",
settings.civicrm.api_key = "[api key of a user]",
settings.civicrm.key = "[civicrm site key]",
// Map usernames to Drupal uid
settings.mapping = {
@mlutfy
mlutfy / civicrm_country.tpl
Created May 9, 2016 14:18
Reverting CRM-16876
/*!40101 SET NAMES utf8 */;
/*******************************************************
*
* civicrm_county
*
*******************************************************/
SET FOREIGN_KEY_CHECKS=0;
REPLACE INTO civicrm_country (id, name,iso_code,region_id,is_province_abbreviated) VALUES("1001", "Afghanistan", "AF", "4", "0");
@mlutfy
mlutfy / timetrack.js
Last active December 6, 2016 14:16
Timetrack CiviCRM Mattermost
/*
Description:
SymbioTIC Time Tracker
Configuration:
HUBOT_TIMETRACK_URL - CiviCRM URL (ex: https://crm.symbiotic.coop).
See also configuration file:
https://gist.github.com/mlutfy/b452f628bd79103a98283c48a2a39770
@mlutfy
mlutfy / gist:9708e96f265c2e751acd843cad2b5af3
Created April 8, 2016 19:14
Shrink varchar select fields
<?php
// Set this to the CiviCRM DB name
$db_name = 'XXXX';
civicrm_initialize();
$sql = "SELECT TABLE_NAME, COLUMN_NAME, CHARACTER_MAXIMUM_LENGTH
FROM INFORMATION_SCHEMA.COLUMNS
WHERE DATA_TYPE IN ('varchar')