This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function vector($arg = null): Vector { | |
return new Vector($arg); | |
} | |
function is_vector($obj): bool { | |
return $obj instanceof Vector; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" this whole thing is super brittle, but was a fun experiment | |
function! s:string_replace(string, new_char, position) | |
let l:string_list = [strpart(a:string, 0, a:position)] | |
let l:string_list = add(l:string_list, a:new_char) | |
let l:string_list = add(l:string_list, strpart(a:string, (a:position + 1))) | |
return join(l:string_list, '') | |
endfunction | |
function! CheckThatBox() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" expiremental async job running thing with status window for neovim. never quite finished it. | |
function! UnmapEscKey() | |
unmap <Esc> | |
echo '' | |
endfunction | |
" log job output to a scratch buffer | |
function! s:LogAsyncJob(job_id, data, event) | |
let cur_buf_win = bufwinnr('%') | |
let job_buf_win = bufwinnr('job_output') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
typedef struct ListItem { | |
int value; | |
struct ListItem *next; | |
struct ListItem *prev; | |
} listitem_t; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function coerceToCamelCase($string) | |
{ | |
$camel = ""; | |
$i = 0; | |
$upper = false; | |
while($i < mb_strlen($string)) { | |
$char = $string[$i]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" source: http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html | |
" just use the cterm color code as the list index to get the gui color code | |
" e.g. ctermfg=237 guifg=s:palette[237] | |
let s:palette = [ | |
\ '#000000', '#800000', '#008000', '#808000', '#000080', '#800080', '#008080', '#c0c0c0', | |
\ '#808080', '#ff0000', '#00ff00', '#ffff00', '#0000ff', '#ff00ff', '#00ffff', '#ffffff', | |
\ '#000000', '#00005f', '#000087', '#0000af', '#0000d7', '#0000ff', '#005f00', '#005f5f', | |
\ '#005f87', '#005faf', '#005fd7', '#005fff', '#008700', '#00875f', '#008787', '#0087af', | |
\ '#0087d7', '#0087ff', '#00af00', '#00af5f', '#00af87', '#00afaf', '#00afd7', '#00afff', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); | |
@-moz-document url("chrome://browser/content/browser.xul") { | |
/* from existing gnome integration css | |
i opened an issue on github about this so presumably it will be fixed at some point | |
but until then (or in case it isn't), this can be added as a stylish userstyle | |
%define tree #TabsToolbar.treestyletab-tabbar-toolbar[orient="vertical"] | |
%define treeDefault @tree@:not([treestyletab-style]) | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$reflection = new \ReflectionClass("\Imagick"); | |
$colorspaces = array_flip( | |
array_filter( | |
$reflection->getConstants(), | |
function ($k) { | |
return mb_strpos($k, "COLORSPACE") !== false; | |
}, | |
ARRAY_FILTER_USE_KEY | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** Inserts a new node after a given reference node. Basically it is the complement to the DOM specification's | |
* insertBefore() function. | |
* @param \DOMNode $newNode The node to be inserted. | |
* @param \DOMNode $referenceNode The reference node after which the new node should be inserted. | |
* @return \DOMNode The node that was inserted. | |
*/ | |
function insertAfter(\DOMNode $newNode, \DOMNode $referenceNode) | |
{ | |
if($referenceNode->nextSibling === null) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
abstract class RecursiveUtils | |
{ | |
/** | |
* Return the entire contents of a directory as SplFileInfo objects including all subdirectories. | |
* @param string $path The path of the directory whose contents you want. | |
* @return array An array of the full paths of those contents. | |
*/ | |
public static function rscandir($path) | |
{ |