Skip to content

Instantly share code, notes, and snippets.

@krusynth
krusynth / nested_terms.php
Last active Nov 15, 2021
Quick and easy way to translate flat arrays into nested arrays in PHP.
View nested_terms.php
<?php
/**
* Wrapper to get terms in a nested fashion.
* This gets a little complicated. Basically, we're creating a placeholder in
* $children to hold the child terms of each parent term. Then we create a
* reference to that element in the parent term. So nesting happens via magic.
*/
public function get_terms_nested($args)
{
$temp_terms = $this->get_terms($args);
@krusynth
krusynth / github-team.py
Last active Aug 7, 2021
Python script to add all GitHub repositories to an organization team - permission is set to push. You'll need a settings.py file with your organization name and API key. Based off of my GitHub stats script (requirements.txt here): https://github.com/krues8dr/project-migration
View github-team.py
#!/usr/bin/python
# Exports a CSV of repo names, readme files, and the license of the project.
from __future__ import print_function
import requests
import json
import settings
from urlparse import urlparse, parse_qs
import sys
@krusynth
krusynth / books.md
Last active Jun 15, 2021
A list of useful books to improve your skills
View books.md

Recommended Books

A list of useful books to improve your skills

Recommendations from others are noted in (parentheses). The rest are my personal recommendations.

Programming

Building your core

  • The Pragmatic Programmer - Hunt & Thomas
@krusynth
krusynth / Kru_MultitileEvents.js
Created May 2, 2017
A plugin for RPG Maker MV to allow multitile events, instead of the 1x1 tile events that are the default.
View Kru_MultitileEvents.js
//=============================================================================
// Multitle Events
// Version: 1.0.0
//=============================================================================
var Imported = Imported || {};
Imported.Kru_MultitileEvents = "1.0.0";
//=============================================================================
/*:
* @plugindesc 1.0.0 Allows for events that are bigger than 1 tile.
*
@krusynth
krusynth / font_awesome.rb
Last active Feb 27, 2021 — forked from 23maverick23/font_awesome.rb
Jekyll: Font Awesome icons Liquid tag
View font_awesome.rb
##
# The MIT License (MIT)
#
# Copyright (c) 2014 Ryan Morrissey
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@krusynth
krusynth / google-fonts.md
Created Nov 18, 2014
Actually Pretty Good Google Fonts
View google-fonts.md
@krusynth
krusynth / gist:2782431
Created May 24, 2012
S3 Uploader for Django
View gist:2782431
# ########################################################
# s3filefield.py
# Extended FileField and ImageField for use with Django and Boto.
#
# Required settings:
# AWS_BUCKET_NAME - String, represents the default bucket name to use if one isn't provided
# AWS_ACCESS_KEY - String
# AWS_SECRET_KEY - String
#
# From here: http://djangosnippets.org/snippets/1976/
@krusynth
krusynth / PromiseMap.js
Created Nov 1, 2019
A wrapper for Promise.all that maps the return data into an object/hash.
View PromiseMap.js
'use strict';
/* Promises.all but uses an Object instead of an array.
*
* Usage:
*
* PromiseMap({
* 'a': new Promise((resolve, reject) => resolve(1)),
* 'b': new Promise((resolve, reject) => resolve(2))
* }).then(result => console.log('done', result));
@krusynth
krusynth / simpleXML_to_object.php
Created Sep 6, 2013
Translates a simpleXML object into a standard PHP object.
View simpleXML_to_object.php
<?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 Sep 1, 2019
Tool to serve a local website. Includes plugin for Powerlevel9K.
View serve.sh
# 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() {