Skip to content

Instantly share code, notes, and snippets.

View LoicMahieu's full-sized avatar
🙈
🙊

Loïc Mahieu LoicMahieu

🙈
🙊
View GitHub Profile
@LoicMahieu
LoicMahieu / backgroundClipText
Created February 13, 2012 21:08
BackgroundClipText - Modernizr Test
<!DOCTYPE HTML PUBLIC>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>BackgroundClipText - Modernizr Test</title>
<script src="modernizr.js"></script>
<script>
function getBgClipValue(elem){
return (
@LoicMahieu
LoicMahieu / backgroundClipText
Created February 13, 2012 21:08
BackgroundClipText - Modernizr Test
<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>BackgroundClipText - Modernizr Test</title>
<script src="modernizr.js"></script>
<script>
function getBgClipValue(elem){
return (
@LoicMahieu
LoicMahieu / gist:4494861
Last active December 10, 2015 21:29
determineDate(date, refDate, defaultDate) Usage: determineDate('+1y') = now + 1 year determineDate('+1d', new Date(2012, 1, 1)) == 2012-01-02
function determineDate(date, refDate, defaultDate) {
var getDaysInMonth = function (year, month) {
var date = new Date(year, month, 32);
date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
return 32 - date.getDate();
},
offsetNumeric = function (offset, date) {
date.setDate(date.getDate() + offset);
return date;
},
// OUTPUT:
// Executing: DROP TABLE IF EXISTS `Persons`;
// Executing: CREATE TABLE IF NOT EXISTS `Persons` (`name` VARCHAR(255), `id` INTEGER NOT NULL auto_increment , `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;
// Executing: DROP TABLE IF EXISTS `Pets`;
// Executing: CREATE TABLE IF NOT EXISTS `Pets` (`name` VARCHAR(255), `id` INTEGER NOT NULL auto_increment , `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, `PersonId` INTEGER, PRIMARY KEY (`id`)) ENGINE=InnoDB;
// Executing: INSERT INTO `Persons` (`name`,`id`,`createdAt`,`updatedAt`) VALUES ('Luke',NULL,'2013-05-29 11:00:37','2013-05-29 11:00:40');
// Executing: INSERT INTO `Pets` (`name`,`id`,`createdAt`,`updatedAt`,`PersonId`) VALUES ('Bob',NULL,'2013-05-29 11:00:37','2013-05-29 11:00:40',NULL);
// Executing: SELECT * FROM `Pets` WHERE `Pets`.`PersonId`=1;
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');
check process coldfusion10 with pidfile /var/run/coldfusion10.pid
start program = "/etc/monit-wrapper /etc/init.d/coldfusion restart" with timeout 60 seconds
stop program = "/etc/monit-wrapper /etc/init.d/coldfusion stop"
if failed host localhost port 80
protocol HTTP request "/CFIDE/administrator/index.cfm"
with timeout 45 seconds
then restart
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1397825720000",
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": [
@LoicMahieu
LoicMahieu / coldfusion
Created June 30, 2014 12:01
Coldfusion 10 - Logrotate
/opt/coldfusion10/cfusion/logs/*.log {
# Log files are rotated every day.
daily
# If the log file is missing, go on to the next one without issuing an error
# message.
missingok
# Log files are rotated count times before being removed or mailed to the
# address specified in a mail directive.
@LoicMahieu
LoicMahieu / install
Last active August 29, 2015 14:03
Coldfusion 10 log4j.properties
curl https://gist.githubusercontent.com/LoicMahieu/077317910cf9e78a18d3/raw/b99605d8a55970328f84f87127414bf3529cae3c/log4j.properties > /opt/coldfusion10/cfusion/lib/log4j.properties