Skip to content

Instantly share code, notes, and snippets.

zandr deathlyfrantic

Block or report user

Report or block deathlyfrantic

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
deathlyfrantic / vector.php
Last active Mar 26, 2018
php object implementation of a standard list (not hashtable)
View vector.php
function vector($arg = null): Vector {
return new Vector($arg);
function is_vector($obj): bool {
return $obj instanceof Vector;
deathlyfrantic / mouse.vim
Created Jan 31, 2017
check/uncheck [x] boxes with the mouse in vim.
View mouse.vim
" 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, '')
function! CheckThatBox()
View async.vim
" expiremental async job running thing with status window for neovim. never quite finished it.
function! UnmapEscKey()
unmap <Esc>
echo ''
" 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')
deathlyfrantic / linked-list.c
Created May 19, 2016
trying to learn C so i wrote a linked list
View linked-list.c
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
typedef struct ListItem {
int value;
struct ListItem *next;
struct ListItem *prev;
} listitem_t;
deathlyfrantic / mini-framework.php
Created Mar 21, 2016
the start of a mini-framework for object<->db abstraction that i will not finish because it's reinvention of the wheel
View mini-framework.php
function coerceToCamelCase($string)
$camel = "";
$i = 0;
$upper = false;
while($i < mb_strlen($string)) {
$char = $string[$i];
deathlyfrantic / 256_color_palette.vim
Created Mar 1, 2016
VimL color array that maps 256 color codes to RGB equivalents
View 256_color_palette.vim
" source:
" 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',
deathlyfrantic / tree-style-tabs.css
Last active Jan 5, 2016
firefox tree style tabs gnome dark theme integration hack
View tree-style-tabs.css
@namespace url("");
@-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])
deathlyfrantic / imagick_colorspace_constants.php
Last active Aug 8, 2017
get useful imagemagick colorspace constants from getImageColorspace() as opposed to mystery integers
View imagick_colorspace_constants.php
$reflection = new \ReflectionClass("\Imagick");
$colorspaces = array_flip(
function ($k) {
return mb_strpos($k, "COLORSPACE") !== false;
deathlyfrantic / dom-insert-after.php
Last active Nov 1, 2018
why doesn't the DOM spec include an insertAfter method, srsly guys
View dom-insert-after.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) {
deathlyfrantic / RecursiveUtils.php
Last active Oct 21, 2015
miscellaneous recursive file system functions for PHP that I shouldn't have to write myself
View RecursiveUtils.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)
You can’t perform that action at this time.