Skip to content

Instantly share code, notes, and snippets.

View ScullWM's full-sized avatar
🌶️
Caramba! PepperReport.io!

Thomas P ScullWM

🌶️
Caramba! PepperReport.io!
View GitHub Profile
<?php
require 'deployer.phar';
task('prod_server', function () {
connect('prod.ssh.test.com', 'user', 'password');
});
task('upload', function () {
upload(__DIR__, '/home/test');
@ScullWM
ScullWM / recursive.php
Created March 7, 2014 09:29
Strange var
<?php
$Directory = new RecursiveDirectoryIterator(__DIR__);
$Iterator = new RecursiveIteratorIterator($Directory, RecursiveIteratorIterator::SELF_FIRST);
$Regex = new RegexIterator($Iterator, '/^.+\.php$/i', RecursiveRegexIterator::GET_MATCH);
echo'<pre>';
var_dump($Regex);
git filter-branch -f --index-filter 'git rm -r --cached --ignore-unmatch path/to/my/specific/file.ext' HEAD
git push -u origin master --force
Source : http://help.github.com/remove-sensitive-data/
@ScullWM
ScullWM / Momentjs
Created October 17, 2014 13:32
Momentjs basic usage
<script>
moment.locale('fr');
var now = moment();
$('.time').each(function(i, e) {
var time = moment($(e).text(), $(e).data('moment-format'));
$(e).html(time.from(now));
});
</script>
<?php
namespace Swm\Bundle\ForumBundle\Listener;
use JMS\DiExtraBundle\Annotation as DI;
use Swm\Bundle\MailHookBundle\Event\HookEventInterface;
/**
* @DI\Service()
*/
@ScullWM
ScullWM / gist:1864105
Created February 19, 2012 14:40
login
public function executeLogin(sfWebRequest $request)
{
$this->form = new LoginForm();
if ($request->isMethod('post'))
{
$this->form->bind($request->getParameter('login'));
echo $request->getParameter('login[login]');
$this->f_reponse = Doctrine_Query::create()
->select('p.*, u.*')
->from('post p')
->leftJoin('p.user u')
->where('p.subject_id = ?', $this->f_sujet->getId())
->execute();
categorie:
tableName: categories
actAs:
Timestampable: ~
Sluggable:
unique: true
fields: [titre]
canUpdate: false
columns:
titre: { type: string(100), notnull: true }
@ScullWM
ScullWM / gist:4176355
Created November 30, 2012 15:18
Just found this function... outch!
$Login='';
$Password='';
$Tab[100];
$j=0;
for ($i=48;$i<59;$i++){
$Tab[$j]=$i;
$j++;
}
for ($i=65;$i<91;$i++){
<?php
public function isAccessOk((array)$abonnements, (array)$userGroupes)
{
$abonnements = array_flip($abonnements);
$userGrp = array_flip($userGroupes);
$at = array_merge($abos, $userGroupes);
return (bool)(count($at)<(count($abonnements)+count($userGroupes)));
}