Skip to content

Instantly share code, notes, and snippets.

View vicb's full-sized avatar

Victor Berchet vicb

View GitHub Profile
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
.tipsy { padding: 5px; font-size: 10px; position: absolute; z-index: 100000; }
.tipsy-inner { padding: 5px 8px 4px 8px; background-color: #000; color: #fff; max-width: 200px; text-align: center; }
.tipsy-inner { border-radius: 3px; -moz-border-radius:3px; -webkit-border-radius:3px; }
.tipsy-arrow { position: absolute; width: 0; height: 0; border: 5px solid transparent; border-color: transparent transparent #000; }
@vicb
vicb / gist:1596588
Created January 11, 2012 20:25
substr vs strpos
<?php
$str = str_repeat('*!', 10);
$start = microtime(true);
for ($i = 0; $i < 100000; $i++) {
substr($str, 0, 1);
}
@vicb
vicb / gist:1810797
Created February 12, 2012 20:52
Cache API
eAccelerator:
eaccelerator_put($key, $data, $ttl)
eaccelerator_get($key)
eaccelerator_rm($key)
eaccelerator_clear()
APC:
apc_store($key, $data, $ttl)
apc_fetch($key)
apc_delete($key)
@vicb
vicb / session.php
Created July 2, 2012 07:31
Session concurrency
<?php
// Native handlers
//ini_set('session.save_path', 'tcp://127.0.0.1:11211');
//ini_set('session.save_handler', 'memcache');
//ini_set('session.save_path', '127.0.0.1:11211');
//ini_set('session.save_handler', 'memcached');
@vicb
vicb / config.yml
Created July 2, 2012 11:55
Form theming 2.1
twig:
form:
resources:
- '::form.html.twig'
@vicb
vicb / gist:3207019
Created July 30, 2012 13:45
Twig issue 792
<?php
// Update with your local path to the autoloader
require_once '../vendor/twig/twig/lib/Twig/Autoloader.php';
Twig_Autoloader::register();
$loader = new Twig_Loader_String();
$twig = new Twig_Environment($loader);
@vicb
vicb / bench.php
Created January 28, 2013 09:33
Doctrine bench
<?php
class Bench
{
public static $cache;
public static $cachem;
public function __construct()
{
self::$cache = array('set' => true, 'tableize_set' => true);
@vicb
vicb / gist:8963078
Created February 12, 2014 19:44
ng.dart error
dart2js
Error occurred: /C:/Users/bwessels/WebstormProjects/angular.dart.tutorial-master/Chapter_01/web/packages/angular/core/scope.dart:74:1: Warning: 'Scope' doesn't implement 'containsValue'. Try adding an implementation of 'containsValue'. class Scope implements Map { ^^^^^ /C:/Program Files/dart/dart-sdk/lib/core/map.dart:109:8: Info: This is the method declaration. bool containsValue(Object value); ^^^^^^^^^^^^^ /C:/Users/bwessels/WebstormProjects/angular.dart.tutorial-master/Chapter_01/web/packages/angular/core/scope.dart:74:1: Warning: 'Scope' doesn't implement 'putIfAbsent'. Try adding an implementation of 'putIfAbsent'. class Scope implements Map { ^^^^^ /C:/Program Files/dart/dart-sdk/lib/core/map.dart:144:5: Info: This is the method declaration. V putIfAbsent(K key, V ifAbsent()); ^^^^^^^^^^^ /C:/Users/bwessels/WebstormProjects/angular.dart.tutorial-master/Chapter_01/web/packages/angular/core/scope.dart:74:1: Warning: 'Scope' doesn't implement 'addAll'. Try adding an implementation of 'addAll'. cl
@vicb
vicb / ex.dart
Last active August 29, 2015 14:02
Dart - JS
import "dart:js" as js;
import "dart:mirrors" as mirrors;
class JsProxy {
js.JsObject $js;
/// Creates the underlying JavaScript object from the [ctorFqn] and a list of [args]
JsProxy.proxy([String ctorFqn, List args = const []])
: this.proxyJsObj(
ctorFqn == null ?
@vicb
vicb / clean.dart
Created July 20, 2014 11:55
Archive merged branches
import 'dart:io';
import 'dart:async';
// Name for the master repo
var UPSTREAM = 'origin';
// Name of your fork
var REMOTE = 'vicb';
void main() {