Skip to content

Instantly share code, notes, and snippets.

@rezozero
rezozero / unzip_preparation.php
Created November 15, 2012 15:50
PHP: Unzip preparation
<?php
/**
* Copyright REZO ZERO 2012
*
* This work is licensed under the Creative Commons Attribution-NoDerivs 2.0 France License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nd/2.0/fr/
* or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
*
* Unzip a prepared site with RZ CMS on remote FTP server
*
@rezozero
rezozero / create_site.sh
Created November 15, 2012 15:28
BASH: Create site
#!bin/bash
# Ambroise Maupate REZO ZERO
echo "---------------------------------------------\n"
echo "- Création d'un nouveau site sur `hostname` -\n"
echo "---------------------------------------------\n"
APACHE_ROOT="/var/www/"
CMS_REL_DIR="../RZ-CMS"
@rezozero
rezozero / prepare_site.sh
Created November 15, 2012 15:28
BASH: Prepare site
#!bin/bash
# Ambroise Maupate REZO ZERO
echo "---------------------------------------------\n"
echo "---------- Préparation d'un site -----------\n"
echo "---- pour son exportation en production ----\n"
echo "---------------------------------------------\n"
APACHE_ROOT="/var/www/"
CMS_REL_DIR="../RZ-CMS"
@rezozero
rezozero / style_reset.less
Created November 9, 2012 15:13
LESS:reset
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
@rezozero
rezozero / gist:4026578
Created November 6, 2012 18:32
JS: makeImagesInRow
/*
* Compute collection images height in order to make them enter in a given width
* We need to know default images height and the given final width
*/
function computeDeployedArticleImages ( article )
{
var computedWidth = 0;
/* We get the first image height */
var startHeight = $(article).find(".img_container img").first().actual("outerHeight", {includeMargin:false});
/* We apply this height to every image before computing global width*/
@rezozero
rezozero / gist:4026523
Created November 6, 2012 18:21
JS: onLoadImages
/* Wait for all images loaded */
var images = $(deployed).find("img");
var nimages = images.length;
images.load(function () {
nimages--;
if(nimages == 0) {
console.log("Images loaded");
}
@rezozero
rezozero / gist:4023945
Created November 6, 2012 10:37
JS: isMobile
function isMobile() {
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) {
return true;
}
else {
return false;
}
}
@rezozero
rezozero / HTML_gettext.sublime-snippet
Created October 31, 2012 10:43
Snippet HTML: gettext
<snippet>
<content><![CDATA[
<?php echo(_("${1:text}")); ?>
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>__</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>text.html, source.html</scope>
</snippet>
@rezozero
rezozero / HTML_input.sublime-snippet
Created October 31, 2012 10:41
Snippet HTML: Input
<snippet>
<content><![CDATA[
<input type="${1:text|hidden|search|email|password}" name="${2:name}" placeholder="${2:placeholder}" value="${2:value}" />
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>input</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>text.html, source.html</scope>
</snippet>
@rezozero
rezozero / gist:3975814
Created October 29, 2012 19:10
JS: Compute deployed article images
/**
* Copyright REZO ZERO 2012
*
* This work is licensed under the Creative Commons Attribution-NoDerivs 2.0 France License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nd/2.0/fr/
* or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
*
* Compute collection images height in order to make them enter in a given width
* We need to know default images height and the given final width
*