Skip to content

Instantly share code, notes, and snippets.

@dmongeau
dmongeau / Message.php
Last active December 22, 2015 14:49
Répondeur avec Twilio
<?php
class Message extends Eloquent {
protected $table = 'messages';
protected $guarded = array();
protected $fillable = array('filename', 'duration', 'from', 'city');
protected $hidden = array('from','city','id','created_at','updated_at');
var CONFIG = require('./config');
var mongoose = require('mongoose'),
express = require('express'),
app = express(),
sanitize = require('validator').sanitize,
server = require('http').createServer(app),
io = require('socket.io').listen(server, {
'flash policy server' : false
});
@dmongeau
dmongeau / tracking.html
Created November 13, 2013 19:26
Exemple de code de tracking
<script type="text/javascript">
var _echolo = _echolo || [];
//S'il y a un utilisateur de connecté, on le spécifie avec son ID
_echolo.push(['setUser', 12]);
//Pour tracker une visite sur une page
_echolo.push(['trackVisit']);
<!-- Beginning of 101 Widget -->
<link media="all" type="text/css" rel="stylesheet" href="//2c820ecf6293c424ffcd-16bd6b31c127d56425d63d7b446e7b4f.r87.cf1.rackcdn.com/widget.v8.css">
<div id="widget-101">
<h2 class="widget-101-title">MTL Blog <br/>is ready <br/>for Quebec’s <br/>independance</h2>
<div class="widget-101-inner">
<a href="#" class="widget-101-close"></a>
<div class="widget-101-text">Now click on something<br/>and make me 'ben contente'</div>
<div class="widget-101-pauline"></div>
<div class="widget-101-form-select">
<select name="lang" class="widget-101-select"><option value="fr">---- Français ----</option><option value="fr">---- Français ----</option><option value="fr">---- Français ----</option><option value="fr">---- Français ----</option><option value="fr">---- Français ----</option><option value="fr">---- Français ----</option></select>
@dmongeau
dmongeau / untitled
Created November 4, 2015 17:43
manivelle_channels.json
query getChannels {
channels {
id
type
snippet {
title
description
summary
picture {
width
@dmongeau
dmongeau / release.sh
Created January 6, 2016 14:44
Release script (Create a release branch, build, merge it and automatically tag to a new version)
#!/bin/zsh
LAST_VERSION=$(git tag -l | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n | tail -n 1)
NEXT_VERSION=$(echo $LAST_VERSION | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{if(length($NF+1)>length($NF))$(NF-1)++; $NF=sprintf("%0*d", length($NF), ($NF+1)%(10^length($NF))); print}')
VERSION=${1-${NEXT_VERSION}}
DEFAULT_MESSAGE="Release"
MESSAGE=${2-${DEFAULT_MESSAGE}}
RELEASE_BRANCH="release/$VERSION"
git add .
@dmongeau
dmongeau / SuperagentNetworkLayer.js
Created January 10, 2017 22:41
Replace the DefaultNetworkLayer in Relay with superagent instead of fetch. I've noticed that when using the Laravel DebugBar the ajax query where not catched with the DefaultNetWorkLayer, switching to superagent resolved the issue.
import { DefaultNetworkLayer } from 'react-relay';
import superagent from 'superagent';
import superagentRetry from 'superagent-retry';
import superagentPromise from 'superagent-promise';
import each from 'lodash/each';
// Add plugins to superagent
superagentRetry(superagent);
superagentPromise(superagent, Promise);
@dmongeau
dmongeau / .travis.yml
Last active April 27, 2022 10:16
Example of travis configuration for Laravel Package testing (5.1 to 5.8) on multiple versions of PHP (5.5 to 7.3) with code coverage (coveralls)
language: php
cache:
directories:
- $HOME/.cache/pip
- $HOME/.composer/cache/files
php:
- 5.6
- 7.0
@dmongeau
dmongeau / embed.html
Last active February 2, 2017 19:43
Embed theinvisiblewalls.btselem.org
<!-- This embed code is similar to YouTube -->
<!-- You can edit the size by changing the "width" and "height" value -->
<iframe src="http://theinvisiblewalls.btselem.org/" width="800" height="600" frameborder="0" allowfullscreen></iframe>
<!-- For assistance, contact dev@atelierfolklore.ca -->
@dmongeau
dmongeau / synology.sh
Last active December 26, 2019 09:34
Shell commands to load a Synology volume in Read-Only when it is corrupted.
mount -o ro,noload /dev/vg1/volume_1 /volume1
df -h
synospace --map-file -d
synocheckshare
ll /volume1