Skip to content

Instantly share code, notes, and snippets.

View wjzijderveld's full-sized avatar

Willem-Jan Zijderveld wjzijderveld

View GitHub Profile
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active May 1, 2024 01:29
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@rosstuck
rosstuck / 1-cookiejar.feature
Last active May 24, 2017 12:03
Behat / ES Helper
Feature: Cookie Jar
Scenario: The last cookie put in the jar is the first eaten
Given I put a raisin cookie in the jar
And I put a chocolate cookie in the jar
When I eat a cookie
Then I should have eaten a chocolate cookie
Scenario: I eat multiple cookies
Given I put a raisin cookie in the jar
@RobThree
RobThree / SoapClientTimeout.class.php
Created April 25, 2012 14:55
PHP SoapClient with timeout
<?php
//Drop-in replacement for PHP's SoapClient class supporting connect and response/transfer timeout
//Usage: Exactly as PHP's SoapClient class, except that 3 new options are available:
// timeout The response/transfer timeout in milliseconds; 0 == default SoapClient / CURL timeout
// connecttimeout The connection timeout; 0 == default SoapClient / CURL timeout
// sslverifypeer FALSE to stop SoapClient from verifying the peer's certificate
class SoapClientTimeout extends SoapClient
{
private $timeout = 0;
private $connecttimeout = 0;
@luetkemj
luetkemj / wp-query-ref.php
Last active April 25, 2024 09:37
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@iaindooley
iaindooley / xpath_escape.php
Created August 19, 2011 03:34
Function to escape single and double quotes in XPath queries using PHP
<?php
function xpathEscape($query,$default_delim = '"')
{
if((strpos($query,'\'') !== FALSE) ||
(strpos($query,'"') !== FALSE))
{
$quotechars = array('\'','"');
$parts = array();
$current_part = '';