Skip to content

Instantly share code, notes, and snippets.

View dinamic's full-sized avatar
😳
I would rewrite the world, but they won't give me the source code.

Nikola Petkanski dinamic

😳
I would rewrite the world, but they won't give me the source code.
View GitHub Profile
<?php
/**
* This class can add WSSecurity authentication support to SOAP clients
* implemented with the PHP 5 SOAP extension.
*
* It extends the PHP 5 SOAP client support to add the necessary XML tags to
* the SOAP client requests in order to authenticate on behalf of a given
* user with a given password.
*
<?php
/**
* Transforms an under_scored_string to a camelCasedOne
*/
function camelize($scored) {
return lcfirst(
implode(
'',
array_map(
@dinamic
dinamic / gist:2f2aa3387d5a3ab776ab
Created December 16, 2015 12:34 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan

OS X Preferences


most of these require logout/restart to take effect

# Enable character repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a shorter Delay until key repeat
@dinamic
dinamic / generic_bitwise_tester
Last active December 31, 2015 12:49
Generic bitwise tester
<?php
class BitwiseTester
{
/**
*
* @var int
*/
protected $flags = 0;
http://nvie.com/posts/a-successful-git-branching-model/
<?php
/**
* FinalKeywordIgnoredInTrait.php
*
* PHP 5.4.13 (cli) (built: Mar 15 2013 02:05:59)
* Copyright (c) 1997-2013 The PHP Group
* Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
* with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans
*
* @link https://bugs.php.net/bug.php?id=62204
@dinamic
dinamic / mock-localStorage.js
Created February 3, 2016 17:54
Example on how to mock the interface of the localStorage object in modern browsers
/**
* Mocking browser local storage
* @see http://stackoverflow.com/questions/11485420/how-to-mock-localstorage-in-javascript-unit-tests
*/
var mockLocalStorage = function() {
var storage = {};
return {
setItem: function(key, value) {
storage[key] = value || '';
@dinamic
dinamic / stub-properties-and-methods-sinon.js
Created February 4, 2016 21:11 — forked from jouni-kantola/stub-properties-and-methods-sinon.js
Sinon.JS used to stub properties and methods in a sandbox. Methods and properties are restored after test(s) are run.
define(['can', 'localCache'], function(can, localCache) {
'use strict';
describe('storeLocal()', function() {
var sandbox;
beforeEach(function() {
// create sandbox environment for mocking about
sandbox = sinon.sandbox.create();
});
@dinamic
dinamic / docker-routing.sh
Created February 23, 2016 13:17
OSX static routing to the docker containers
#!/bin/bash
sudo route -n add 172.17.0.0/16 `docker-machine ip default`
netstat -nr |grep 172\.17