Skip to content

Instantly share code, notes, and snippets.

@krusynth
krusynth / simpleXML_to_object.php
Created September 6, 2013 13:33
Translates a simpleXML object into a standard PHP object.
<?php
/*
* Translate a non-standard object into an associative array object.
* Super-useful for dealing with simplexml objects.
*/
function simpleXML_to_object($obj)
{
$data = new StdClass();
if(
(is_object($obj) && get_class($obj) == 'SimpleXMLElement')
@krusynth
krusynth / serve.sh
Created September 1, 2019 00:30
Tool to serve a local website. Includes plugin for Powerlevel9K.
# Serve a local static website
# Requires jq for node package info! https://stedolan.github.io/jq/
typeset -A KJOBSLIST
KSERVE_ICON_DEFAULT="\uf013"
KSERVE_ICON_SERVE="\uf233"
KSERVE_ICON_BUILD="\uf021"
# Serve the current directory as a website at port 8000
function kserve() {
@krusynth
krusynth / bigfork.zs
Created May 19, 2019 19:50
Minecraft CraftTweaker recipes for BigFork modpack
// Easier clay
recipes.addShapeless('bigfork_clay',<minecraft:clay>*4,[<minecraft:dirt>,<minecraft:dirt>,<minecraft:dirt>,<minecraft:dirt>]);
// Easier leather, replace monster jerky from Tinkers Construct
mods.tconstruct.Drying.removeRecipe(<tconstruct:edible:10>, <minecraft:rotten_flesh>);
mods.tconstruct.Drying.addRecipe(<minecraft:leather>,<minecraft:rotten_flesh>, 100);
// Add back missing Botania flowers with Easy Pickings flowers
mods.botania.Apothecary.addRecipe(<easypickings:flower_daybloom>,[<ore:petalYellow>,<ore:petalYellow>,<ore:petalOrange>,<ore:petalLightBlue>]);
mods.botania.Apothecary.addRecipe(<easypickings:flower_nightshade>,[<ore:petalBlack>,<ore:petalBlack>,<ore:petalPurple>,<ore:petalGray>]);
@krusynth
krusynth / safeobj.md
Last active May 18, 2019 14:32
SafeObj.js : Fancy map/reducer for complex Javascript data objects. Check out the tests below to see all the features.
@krusynth
krusynth / typography.less
Created June 21, 2012 21:44
LESS CSS makes typography sooo much easier.
/******************* TYPOGRAPHY *******************/
/* Variables & Mixins */
/* Fonts & weights */
@font-stack-main: "franklin-gothic-urw-cond", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
@font-weight-book: 400;
@font-weight-medium: 500;
@font-weight-demi: 700;
@krusynth
krusynth / gulpfile.js
Last active April 28, 2019 02:05
RPG Maker MV JavaScript bundling via Gulp
'use strict'
const gulp = require('gulp');
const imageResize = require('gulp-image-resize');
const path = require('path');
const del = require('del');
const concat = require('gulp-concat');
const uglify = require('gulp-uglify-es').default;
const replace = require('gulp-replace');
const clean = require('gulp-clean');
@krusynth
krusynth / SolarizedDarkPatched.itermcolors
Created February 19, 2019 02:38
Patched version of Solarized Dark to work with ZSH + Spaceship. Preserves standard colors.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.25332435965538025</real>
@krusynth
krusynth / governmentify.sh
Created March 8, 2014 19:27
Uses ImageMagick to read in a text file, transform it into an image, rotate it, add noise, and output as a pdf.
cat ./1-219.1.txt | convert \
-font Courier \
text:- \
-rotate `convert null: -format '%[fx:rand()*15-7]' info:` \
-attenuate 0.1247 +noise Gaussian \
-colorspace Gray \
1-219.1.pdf
@krusynth
krusynth / hostname.conf
Created December 6, 2012 21:20
Apache log format that shows the hostname
LogFormat "%h %l %u %t \"%m http://%{Host}i%U %H\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" hostnames
CustomLog "/private/var/log/apache2/access_log" hostnames
@krusynth
krusynth / list.blade.php
Last active August 22, 2017 16:27
Hack to use Ajax to rehash all mods in Technic Solder. Replaces app/views/mod/list.blade.php
@extends('layouts/master')
@section('title')
<title>Mod Library - TechnicSolder</title>
@stop
@section('content')
<div class="page-header">
<h1>Mod Library</h1>
</div>
<div class="panel panel-default">
<div class="panel-heading">