Skip to content

Instantly share code, notes, and snippets.

@trylik
trylik / gist:1151195
Created August 17, 2011 09:37
Example jquery Ui datepicker
// date picker
$(function() {
var dates = $( "#from, #to" ).datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 3,
firstDay: 1,
dayNamesMin: ['Nd', 'Pn', 'Wt', 'Śr', 'Cz', 'Pt', 'So'],
monthNames: ['Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień'],
@trylik
trylik / mon3.php
Created June 9, 2011 05:01
MongoDB MapReduce Example
<?php
$conn = new Mongo('localhost');
// access database
$db = $conn->benchmark;
// access collection
$stats = $db->coll3;
$map = new MongoCode("function() { emit(this.shop_hash,1); }");
@trylik
trylik / mongo.php
Created June 7, 2011 10:32
mongoDB insert benchmark
<?php
try {
// open connection to MongoDB server
$conn = new Mongo('localhost');
// access database
$db = $conn->benchmark;
// access collection
$collection = $db->coll;
@trylik
trylik / bypass.php
Created April 28, 2011 06:39
Bypassing apache_request_headers() for phpunit
<?php
function request_headers()
{
if(function_exists("apache_request_headers")) // If apache_request_headers() exists...
{
if($headers = apache_request_headers()) // And works...
{
return $headers; // Use it
}
}