Skip to content

Instantly share code, notes, and snippets.

@julienhay
julienhay / tmux_loader.sh
Last active August 29, 2015 14:07
Tmux Loader
#!/bin/bash
SESSIONNAME="work"
tmux has-session -t $SESSIONNAME > /dev/null
if [ $? != 0 ]
then
tmux new-session -s $SESSIONNAME -n "vagrant" -d
tmux new-window -t $SESSIONNAME:1 -n "vserver"
@julienhay
julienhay / mediamixin
Created September 23, 2014 08:33 — forked from remyzv/mediamixin
@mixin media($point) {
@if $point == mobile {
@media screen and (max-width : em(768)) { @content ; }
}
@else if $point == tablet {
@media screen and (max-width : em(992)) and (min-width: em(768)) { @content ; }
}
@else if $point == laptop {
@media screen and (max-width : em(1200)) and (min-width: em(992)) { @content ; }
}
@julienhay
julienhay / CustomTwigExtension.php
Created September 22, 2014 15:05
Twig filter beautiful slice
<?php
namespace ES\SamsungCSBundle\Twig;
class CustomTwigExtension extends \Twig_Extension
{
public function getFilters()
{
return array(
new \Twig_SimpleFilter('slice_beautiful', array($this, 'beautifulTruncate')),
<?php
App::uses('AppController', 'Controller');
App::uses('Folder', 'Utility');
App::uses('File', 'Utility');
App::uses('CakeTime', 'Utility');
class ExempleController extends AppController {
public function implementedEvents()
{
@julienhay
julienhay / ExampleController.php
Last active August 29, 2015 14:01
Upload files example Cakephp + CRUD
<?php
App::uses('AppController', 'Controller');
App::uses('Folder', 'Utility');
App::uses('File', 'Utility');
App::uses('CakeTime', 'Utility');
class ExampleController extends AppController {
public static $accept_types = array(
@julienhay
julienhay / AppController.php
Created May 7, 2014 13:46
Auth Init Cakephp
class AppController extends Controller {
public $components = array(
'Auth',
'Session',
);
@julienhay
julienhay / AppController.php
Created April 14, 2014 14:34
Action upload Cakephp (to adapt)
<?php
public function video($fiche_id = null)
{
$this->breadcrumb[] = array(
'text' => __('Gestion vidéo')
);
$zone_id = $this->request->params['named']['zone'];
@julienhay
julienhay / index.php
Created April 11, 2014 10:11
first end in foreach PHP
<?php
foreach($array as $element) {
if ($element === reset($array))
echo 'FIRST ELEMENT!';
if ($element === end($array))
echo 'LAST ELEMENT!';
}
@julienhay
julienhay / deploy.rb
Created April 8, 2014 16:16
Deploy Cakephp Capistrano 3
# config valid only for Capistrano 3.1
lock '3.1.0'
set :application, 'YourJouney'
set :repo_url, 'git@ks301997.kimsufi.com:yourjourney.git'
# Default branch is :master
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }
# Default deploy_to directory is /var/www/my_app
@julienhay
julienhay / base.html.twig
Last active April 9, 2024 15:38
Base Twig file with Jquery, Jquery UI & Bootstrap (CDN)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}{% endblock %}</title>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" />
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap-theme.min.css" />