Skip to content

Instantly share code, notes, and snippets.

@thecodewarrior
thecodewarrior / a_original.js
Created April 22, 2018 19:48
The JS from http://jsfiddle.net/hakim/Ht6Ym/ obfuscated with https://github.com/thecodewarrior/javascript-obfuscator using the various identifier names generators
var supports3DTransforms = document.body.style['webkitPerspective'] !== undefined ||
document.body.style['MozPerspective'] !== undefined;
function linkify( selector ) {
if( supports3DTransforms ) {
var nodes = document.querySelectorAll( selector );
for( var i = 0, len = nodes.length; i < len; i++ ) {
var node = nodes[i];
@thecodewarrior
thecodewarrior / iTunesDisable.sh
Last active April 16, 2018 22:39
Two scripts to completely disable and reenable iTunes on macOS - http://bit.do/iTunesDisable
#!/bin/sh
echo "Clearing executable bit for iTunes binary"
sudo chmod ugo-x /Applications/iTunes.app/Contents/MacOS
import Foundation
protocol AssociatedValueType: class {}
extension AssociatedValueType {
var associatedDictionary: AssociatedDictionary {
return AssociatedDictionary.associatedDictionary(for: self)
}
}
@thecodewarrior
thecodewarrior / AssociatedValues.swift
Last active March 26, 2018 00:53
More convenient key-value observation
import Foundation
protocol AssociatedValueType: class {}
extension AssociatedValueType {
var associatedDictionary: AssociatedDictionary {
return AssociatedDictionary.associatedDictionary(for: self)
}
}
@thecodewarrior
thecodewarrior / Swift Evolution Mailing List Formatter.js
Created February 20, 2018 08:36
Re-formats the angle bracket email quoting from a mailing list as actual indentation levels with nice lines. For use with TamperMonkey.
// ==UserScript==
// @name Swift-Evolution Email Formatting
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Formats the nested `>` indents of the mailing list into depth-marking lines
// @author TheCodeWarrior
// @match https://lists.swift.org/pipermail/swift-evolution/*
// @grant none
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js
// ==/UserScript==
@thecodewarrior
thecodewarrior / UIVisualEffectViewAdjuster.swift
Created February 11, 2018 23:10
An extension that allows you to freely adjust the amount of blur on a UIVisualEffectView. Tested on iOS 11.2 with Swift 4
extension UIVisualEffectView {
public var adjuster: UIVisualEffectViewAdjuster {
get {
if let adjuster = objc_getAssociatedObject( self, &UIVisualEffectViewAdjuster.key) as? UIVisualEffectViewAdjuster {
return adjuster
} else {
let adjuster = UIVisualEffectViewAdjuster(effectView: self)
objc_setAssociatedObject( self, &UIVisualEffectViewAdjuster.key, adjuster, .OBJC_ASSOCIATION_RETAIN)
return adjuster
}
@thecodewarrior
thecodewarrior / charts.rb
Created November 10, 2016 08:23
Internet uptime tracker
#!/usr/bin/env ruby
require 'gruff'
require 'date'
require 'csv'
CALCULATE_PIXELS = true
DO_JUMP = false
MAX_PING = 500
package thecodewarrior.soundcap;
import net.minecraftforge.common.config.Configuration;
import org.apache.logging.log4j.Logger;
import paulscode.sound.SoundSystemConfig;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
@Mod(modid = SoundCapMod.MODID, version = SoundCapMod.VERSION)
#!/usr/bin/env python
import math, os, re
from gimpfu import *
MERGE_MODE = 1
PATH_PREFIX = "!pth "
FILE_PREFIX = "!file "
TEXTURE_PREFIX = "!!"
REFERENCE_PREFIX = "!ref"
{
"test": "v2"
}