Skip to content

Instantly share code, notes, and snippets.

@furnox
furnox / AnObj.php
Last active January 2, 2020 19:07 — forked from nick-mok/AnObj.php
This is a revision of Nick Mokisasian's (https://gist.github.com/nickunderscoremok/5857846) revision of George Mihailov's (https://gist.github.com/Mihailoff/3700483) PHP Anonymous Object Class. I wanted to bind $this to the methods in the anonymous class. Coded and tested on PHP 5.5.
<?php
class AnObj
{
protected $methods = array();
protected $properties = array();
public function __construct(array $options)
{
@furnox
furnox / pystash.py
Created February 3, 2020 18:18
PyCurses manager for git stashes
#!//usr/bin/python3
import curses
import subprocess
import io
import re, time
def anyKeyToContinue(stdscr):
stdscr.addstr('\n\nPress any key to continue...')
curses.doupdate()
@furnox
furnox / SCC_Annotations.ktf
Created February 3, 2020 18:22
Tool to show git and Subversion annotations (blame) in the file
/*
komodo tool: SCC Annotations
============================
async: 0
is_clean: true
keyboard_shortcut: Ctrl+K, Ctrl+A
language: JavaScript
rank: 100
trigger: trigger_postopen
trigger_enabled: 0
@furnox
furnox / loggr
Created March 23, 2020 23:55
Nice little bash script to show better information on a git commit
#!/bin/bash
#
# Call on .gitconfig with: "!bash -ec 'loggr $0 | less -r'"
# Params:
# commit - pass in commit to display just that commit
#
if [[ $1 != 'bash' ]]; then
if [[ $1 =~ [0-9a-f]{7} ]]; then
rl=($1)
else
#!/usr/bin/python3
results = {}
def stats(num):
if num in results:
return results[num]
if num == 1:
return 0
if num % 2 == 0:
hops = stats(num // 2) + 1