Skip to content

Instantly share code, notes, and snippets.

apiCall: function(params) {
var user = Session.get('username')
var pass = Session.get('password')
// remove params we can't override
delete params.beforeSend
params.url = baseApiUrl + Session.get('twitter_id') + params.url
var ajaxParams = _.extend({
@julesbou
julesbou / install.sh
Last active September 9, 2019 09:26
Debian 6.0 (Squeeze) 64 bits - (NodeJS/Nginx/Mongodb) - Suited for Frontend/Backend
###
### Debian configuration
###
# --- Bashrc ---
echo "
@julesbou
julesbou / config.json
Created October 1, 2012 19:40
Add CORS to deployd (do not support users collection)
{
"type": "Cors"
}
# foo
## foo
---
- ul
- li
- li
css:
sass public/css/main.scss | autoprefixer > public/var/styles.css
watch:
chokidar 'public/js/**/*.scss' 'public/css/**/*.scss' -c 'time make css'
test_chrome:
karma start config/karma.conf.js --single-run --browsers Chrome
test_ff:
<?php
function timezone_options()
{
$zones = array(
‘Africa’,
‘America’,
‘Antarctica’,
‘Arctic’,
‘Asia’,
function get_timezone_infos() { 
var now = new Date(); 
var jan1 = new Date(now.getFullYear(), 0, 1, 0, 0, 0, 0); 
var temp = jan1.toGMTString(); 
var jan2 = new Date(temp.substring(0, temp.lastIndexOf(‘‘) —  1)); 
var offset = (jan1 —  jan2) / (1000);
var june1 = new Date(now.getFullYear(), 6, 1, 0, 0, 0, 0); 
temp = june1.toGMTString(); 
var june2 = new Date(temp.substring(0, temp.lastIndexOf(‘‘) —  1)); 
<?php
// set the timezone of the current user before calling the function
date_default_timezone_set(‘Europe/Paris’);
function toUser($dateTime)
{
$dateTime->setTimezone(new DateTimeZone(date_default_timezone_get()));
return $dateTime;
}
<?php
try {
$db = new Database($dsn, $user, $password);
} catch (RuntimeException $e) {
echo ‘Error during connection : ‘ . $e->getMessage();
}
<?php
class Car {
protected $speed;
protected $engine;
public function __construct(Engine $engine) {
$this->engine = $engine;
}