Skip to content

Instantly share code, notes, and snippets.

@paxperscientiam
paxperscientiam / createthumb.phps
Last active April 8, 2016 03:43
experimental addition to claviska/SimpleImage
<?PHP
// Disclaimer: USE AT YOUR OWN PERIL
//Script for generating 'thumbs' for SimpleImage.
namespace abeautifulsite;
use Exception;
//test for the environment ... CLI versus browser
if (PHP_SAPI === 'cli') {
$reldir = $argv[1];
@paxperscientiam
paxperscientiam / createjson.php
Last active April 7, 2016 18:27
JSON manifest of HTML <img/> "src" and "alt" atributes
<?PHP function fileListJSON($small,$big,$outJSON) {
$outJSON = $outJSON;
// Sort the files alphanumerically, naturally. (thumbs)
if ($handle = opendir($small)) {
$files = array();
while ($files[] = readdir($handle));
sort($files,SORT_NATURAL);
@paxperscientiam
paxperscientiam / php-includes-ov.el
Last active July 8, 2016 12:36
php include show
;;; active experiment -- YOU USE THIS CODE AT YOUR OWN PERIL
;;; comments and criticisms welcome
;; dependencies: ShingoFukuyama/ov.el
;; credits: offby1 & ijp @ freenode/#emacs
;;
;;
;;; set variables
(setq captureFileRegExp "^<\\?php\s+include\s+[\"\']\\([\/a-z0-9]+\.[a-z]+\\)[\"\']\;\/\/ov\s+\\?>\n$")
;;
;;
;; xr - convert string regexp to rx notation
(require 'rx)
(defun xr-parse-char-alt ()
(let ((set nil))
(when (looking-at "]")
(forward-char 1)
(setq set (list "]")))
(while (not (looking-at "]"))
@paxperscientiam
paxperscientiam / .manifestrc
Last active December 27, 2016 18:46
example config file for manifest.bash
#!/opt/local/bin/bash
###################################
# Where output is manifested.
declare -x _BASE="${HOME}/The Cloud/Dropbox/Prometheus/"
# Package Managers
declare -ax _PKGS=(
"npm"
"port"
"gem"
@paxperscientiam
paxperscientiam / example
Created September 15, 2016 18:47
Exporting UTF-8 WS Data with VBA
I've posted this on Microsoft Answers and Reddit already, but, for posterity, I'm putting it on Pastebin too.
Refer to this paste: http://pastebin.com/US1wuKgH
Or, to the StackOverflow post by Robert Knight if it still exists: https://stackoverflow.com/questions/6136798/vba-shell-function-in-office-2011-for-mac
Basically, you feed execShell() a script that copies the data from a worksheet and passes it from the clipboard into a newly formed file. The trick, though, is to set the "locale" of the newly spawned shell session.
Example VBA code:
***
rngSomeRange.copy
@paxperscientiam
paxperscientiam / getroundinteger.bas
Created September 15, 2016 18:48
VBA nearest integer
Function getRoundInteger(num As Double) As Double
Const BUG As Boolean = 1
Dim er As Integer: er = 0
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' getRoundInteger( ) v.1.0
' Function getRoundInteger( ) takes a double and uses the "rounds half up" method (towards +∞) to get the nearest "integer".
' The error stuff was just an experiment that will get it's on follow up.
' Works pretty well, though use at your own discretion!
' ~ Pax Per Scientiam
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
@paxperscientiam
paxperscientiam / execShell.bas
Created September 15, 2016 18:59
execShell VBA module by Robert Knight
' This User Defined Function was written by Robert Knight of StackOverflow
' Designed for Excel 2011, though it might work in the Windoze version too.
' It is shared here for posterity.
Private Declare Function popen Lib "libc.dylib" (ByVal command As String, ByVal mode As String) As Long
Private Declare Function pclose Lib "libc.dylib" (ByVal file As Long) As Long
Private Declare Function fread Lib "libc.dylib" (ByVal outStr As String, ByVal size As Long, ByVal items As Long, ByVal stream As Long) As Long
Private Declare Function feof Lib "libc.dylib" (ByVal file As Long) As Long
@paxperscientiam
paxperscientiam / archive
Created October 18, 2016 15:38
Archive web projects
#!/opt/local/bin/bash
# you should be sure to alter the above path to match the bash you want to use.
# adjust source and target to match your needs.
# adjust exclusions to match your needs.
# recommendation: use in conjunction with cron.
#
# As part of a multipronged strategy, I use rsync for archiving my work on Dropbox.
# As always, use this code at your own peril.
# sass-lint config generated by make-sass-lint-config v0.1.2
#
# The following scss-lint Linters are not yet supported by sass-lint:
# DisableLinterReason, ElsePlacement, PropertyCount, SelectorDepth
# SpaceAroundOperator, TrailingWhitespace, UnnecessaryParentReference, Compass::*
#
# The following settings/values are unsupported by sass-lint:
# Linter Indentation, option "allow_non_nested_indentation"
# Linter Indentation, option "character"
# Linter NestingDepth, option "ignore_parent_selectors"