Skip to content

Instantly share code, notes, and snippets.

@bigwhoop
bigwhoop / gist:6870288
Created October 7, 2013 15:57
Returns the current scale value used by bcmath. #php
<?php
/**
* Returns the current scale value used by bcmath.
*
* @return int
*/
function getbcscale() {
$scale = strlen(bcadd('0', '0')) - 2;
if ($scale === -1) {
$scale = 0;
@bigwhoop
bigwhoop / gist:4060588
Created November 12, 2012 17:13
deferred statements in php
'defer' puts statements on a LIFO stack and executes them right before the function returns.
<?php
function fooz() { function fooz() {
defer echo 'bai';
defer echo 'thx'; ... becomes ...
echo 'k'; echo 'k';
echo 'thx';
echo 'bai';
} }
<?php
function en(array $a)
{
$b = array($a[0]);
for ($i = 1, $l = count($a); $i < $l; $i++) {
$j = count($b) - 1;
$x = explode('-', $b[$j]);
if ((reset($x) >= end($x) && $a[$i] == end($x) - 1) || (reset($x) <= end($x) && $a[$i] == end($x) + 1)) {
// ==UserScript==
// @name Jira "Assign to me"
// @namespace *
// @include */CreateIssue.jspa
// ==/UserScript==
var target = document.getElementById('assignee');
if (target.parentNode.hasChildNodes) {
for (var i = 0; i < target.parentNode.childNodes.length; i++) {
var child = target.parentNode.childNodes[i];
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.49-community MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
@bigwhoop
bigwhoop / Failure
Created February 17, 2014 13:38
Vagrant: Failed to mount folders in Linux guest
Bringing machine 'default' up with 'virtualbox' provider...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Running 'pre-boot' VM customizations...
[default] Booting VM...
[default] Waiting for machine to boot. This may take a few minutes...