Skip to content

Instantly share code, notes, and snippets.

@dator-zz
dator-zz / index.html
Created October 5, 2012 12:21
CorrectionTP
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<script type="text/javascript">
var compteur = 5,
nb = Math.floor(Math.random() * 100),
resp = null;
<?php
// here is my previous code, i open and save directly the original size and there was a transparency issue.
$imagine = new Imagine\Gd\Imagine();
$image = $imagine->open($file->getTempName())
->save('path'), array('quality' => 95));
// with this, no more issue, because resize use the imagealphablending function
<?php
list($new_w, $new_h) = $sizes;
$image = $imagine->open($file->getTempName())
->resize(new Box($new_w, $new_h))
->save($this->_getNewPath($directory), array('quality' => 95));
@dator-zz
dator-zz / gist:3683561
Created September 9, 2012 09:57
Mount a freebox
tell application "Finder"
try
mount volume "smb://freebox" as user name "GUEST"
delay 1
end try
end tell
<?php
class Client{
public function run(Repository $repository, $command)
{
$descriptors = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"));
$process = proc_open($this->getPath() . ' ' . $command, $descriptors, $pipes, $repository->getPath());
if (!is_resource($process)) {
throw new \RuntimeException('Unable to execute command: ' . $command);
- Prendre le code
- Créer votre app
- Mettre l'url de retour dans les settings de votre app (section: Website with Facebook Login)
- Changer les clefs api dans le code
- Télécharger la lib fb pour php (github.com/facebook/facebook-php-sdk)
- Lancer et Profit!
{
"name": "clement/test",
"description": "test",
"require": {
"silex/silex": "dev-master",
"symfony/form": "dev-master",
"twig/twig": "dev-master",
"fp/lightopenid": "dev-master"
},
3 tables: Product, Category, ProductCategory
A product has many categories and a category can belong to many products.
The category objet is nestedset(via doctrine behavior) with a parent, and a position.
I need to be able to manage these categories (up/down/delete/new/edit)
I need to be able to add many categories to a product.
AFAIK, when a category (cat1) has a parent (cat0), and you want to add cat1 to a product, you need to add cat0 too.
assetic:
debug: %kernel.debug%
use_controller: false
filters:
cssrewrite: ~
sass: ~
yui_js:
jar: %kernel.root_dir%/java/yuicompressor.jar
yui_css:
jar: %kernel.root_dir%/java/yuicompressor.jar
<?php
$str = htmlentities($str, ENT_NOQUOTES, $charset);
$str = preg_replace('#\&([A-za-z])(?:acute|cedil|circ|grave|ring|tilde|uml)\;#', '\1', $str);
$str = preg_replace('#\&([A-za-z]{2})(?:lig)\;#', '\1', $str); // pour les ligatures e.g. '&oelig;'
$str = preg_replace('#\&[^;]+\;#', '', $str); // supprime les autres caractères