Skip to content

Instantly share code, notes, and snippets.

// Go to http://www.campus-booster.net/Booster/students/classMembers.aspx
// Open your browser javascript console
// And execute this
var html = $('body').innerHTML
var regex = /http:\/\/www\.campus-booster\.net\/actorpictures\/([0-9]+)\.jpg/g
var ids = []
while (null != (match = regex.exec(html))) {
ids.push(match[1])
@adrienbrault
adrienbrault / output.sh
Last active December 10, 2015 21:38
Rankstache in progress!
root at daffy in /var/www/rankstache (master●●)
$ time sf2 rankstache:appstore:compute:sales US
[DOWN] 305709452 price went from 2.99 to 0.99 the Wednesday, 09-Jan-13 19:17:13 UTC
[DOWN] 323900743 price went from 9.99 to 0.00 the Wednesday, 09-Jan-13 17:50:50 UTC
[ UP ] 345439314 price went from 0.00 to 1.99 the Wednesday, 09-Jan-13 19:05:49 UTC
[ UP ] 348144738 price went from 0.99 to 1.99 the Wednesday, 09-Jan-13 19:51:50 UTC
[ UP ] 354941604 price went from 0.00 to 6.99 the Wednesday, 09-Jan-13 19:51:48 UTC
[ UP ] 364749914 price went from 0.99 to 2.99 the Wednesday, 09-Jan-13 19:51:50 UTC
[DOWN] 365496638 price went from 1.99 to 0.99 the Wednesday, 09-Jan-13 11:59:33 UTC
[ UP ] 369346683 price went from 2.99 to 3.99 the Wednesday, 09-Jan-13 19:00:48 UTC
<?php
if ($argc != 2) {
die('Usage: cd ~/Developer/FSCV2 && php rsync.php <remote_path>');
}
$user = 'vagrant';
$host = 'fsc.local';
$localPath = getcwd() . '/';
$remotePath = $argv[1];
@adrienbrault
adrienbrault / fun.sh
Created November 27, 2012 20:51
How to have fun in an apple store
for i in {9..1}; do say $i && sleep 1; done; say boom boom boom
@adrienbrault
adrienbrault / 1.xml
Created November 22, 2012 21:31
symfony-hateoas-sandbox example usage with curl
$ curl -i -X GET "http://localhost:8000/"
HTTP/1.1 200 OK
Host: localhost:8000
Connection: close
X-Powered-By: PHP/5.4.7
cache-control: no-cache
content-type: application/vnd.fr.adrienbrault.hateoas+xml
x-debug-token: 50ae98a0c817e
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<spot id="26740">
<link rel="self" href="http://api.fsc.local/app_dev.php/spots/26740"/>
<link rel="https://rels.api.thefootballsocialclub.com/supporters" href="http://api.fsc.local/app_dev.php/spots/26740/supporters"/>
<link rel="https://rels.api.thefootballsocialclub.com/official-teams" href="http://api.fsc.local/app_dev.php/spots/26740/official-teams"/>
<link rel="https://rels.api.thefootballsocialclub.com/support" href="http://api.fsc.local/app_dev.php/users/267309/supported/forms/add?add%5Bid%5D=26740"/>
<name><![CDATA[Ghazi Stadium]]></name>
<description/>
<subCategory><![CDATA[stadium]]></subCategory>
<category><![CDATA[grounds]]></category>
@adrienbrault
adrienbrault / purge.sh
Created September 24, 2012 10:02
Script to reduce VM size before packaging for vagrant
#!/bin/sh
# Credits to:
# - http://vstone.eu/reducing-vagrant-box-size/
# - https://github.com/mitchellh/vagrant/issues/343
aptitude -y purge ri
aptitude -y purge installation-report landscape-common wireless-tools wpasupplicant ubuntu-serverguide
aptitude -y purge python-dbus libnl1 python-smartpm python-twisted-core libiw30
aptitude -y purge python-twisted-bin libdbus-glib-1-2 python-pexpect python-pycurl python-serial python-gobject python-pam python-openssl libffi5
@adrienbrault
adrienbrault / 1_ReplaceNotSubmittedValuesByDefaultsListener.php
Created September 22, 2012 16:33
SF2 Form Event Subscriber that replace non submitted values by the default.
<?php
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormFactoryInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Form\FormEvents;
/**
* ReplaceNotSubmittedValuesByDefaultsListener
*
@adrienbrault
adrienbrault / sf2.php
Created September 10, 2012 14:41
sami example that includes protected/private properties/methods
<?php
use Sami\Sami;
use Sami\Version\GitVersionCollection;
use Sami\Parser\Filter\TrueFilter;
use Symfony\Component\Finder\Finder;
$iterator = Finder::create()
->files()
->name('*.php')
john:
friends:
- John
- Marc