Skip to content

Instantly share code, notes, and snippets.

<Response>
<Speak >This number does not accept incoming phone calls</Speak>
</Response>
require 'rspec'
def flatten(arr)
result = Array.new
arr.each do |item|
result.concat item.kind_of?(Array) ? flatten(item) : [item]
end
result
end
@intval
intval / gist:09d5653bf13963cc234a
Last active October 19, 2015 16:19
contuntful io, rtl button
window.setTimeout(function(){
var toolbar = $('div.markdown-toolbar');
var textarea = $('textarea.markdown-textarea');
var preview = $('div.markdown-preview');
var current = "ltr";
if(toolbar.length == 1)
{
var btn = $('<button tabindex="-1" tooltip="RTL" style="background-image: url(http://git.mate-desktop.org/mate-themes/plain/icon-themes/ContrastHigh/32x32/actions/format-indent-more-rtl.png)" class="toolbar-button toolbar-button-flex"></button>');
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCsaUsH2NsgRDNgT5BrodagWWI1L6KUm6vap/3OPWdNKj67QzncVDsMyXLosutzldVp1GzINudY3lXPrcDErGi7kQPcwL6CcKidg2wC5/SnUU+uuhOv3jjSR6tNvegI6jpQ1HYMOGSDV6qo6wlVfcTur9dHM8ZejqMXnTJJ7MbwK1MA2CbTOx0vy/o1lax7dvicPFuioVy5J6vzDbVSW10hhhFn6RSU0bIS7c5K6PxE/uauAs2ZVc8lsiqZf7p0Mq9U6FtEdQmCOhFB8MstUe9soYLDN7rWk7TdKL1Kz/GrggCo/B2jwczPfFNrH2TUlzqP6WjItW3Db7dIhsx7Jc8R raskin@TPG_DEV_001
#!/usr/bin/php
<?php
/**
* .git/hooks/pre-commit
*
* This pre-commit hooks will check for PHP errors
*
*/
RunPHPLoc();
@intval
intval / gist:2e8d6baf632ce5bc82e8
Created November 1, 2014 14:51
Linked List php example - unimplemented
<?php
class Node
{
/** @var int $value - The value of the item */
public $value;
/** @var Node $next - Reference to the next item in list */
public $next;
// divides array into equal arrays, each of size n
function by(n, arr)
{
function byby(n, arr, accum)
{
if(arr.length < 1) return accum;
var head = [arr.slice(0,n)];
var tail = arr.slice(n);
return byby(n, tail, accum.concat(head));
}
@intval
intval / websockets_encode_decode.php
Created May 20, 2013 18:30
websockets encoding and decoding functions
<?php
function hybi10Encode($payload, $type = 'text', $masked = true)
{
$frameHead = array();
$frame = '';
$payloadLength = strlen($payload);
switch($type)
{
class RamCache
{
private static $data = array();
public static function set($key, $value)
{
self::$data[$key] = $value;
}
public static function get($key)
@intval
intval / gist:3798792
Created September 28, 2012 09:09
Handle fatal errors php
<?php
function the_last_function()
{
static $haltCodes = array(E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR);
$error = error_get_last();
if ($error && in_array($error['type'], $haltCodes))
{