Skip to content

Instantly share code, notes, and snippets.

View nyteshade's full-sized avatar

Brielle Harrison nyteshade

View GitHub Profile
@nyteshade
nyteshade / DynamicNamedFunctions.js
Last active December 16, 2015 13:09
Some functions to programmatically generate named functions in JavaScript instead of anonymous ones. Of potential interest to debugging.
function CreateNamedFnProxy(name, fn, context) {
var template = [
'(function @name() {',
' @name.fn.apply(@name.context || window, arguments);',
'})'
].join('').replace(/@name/g, name),
result = eval(template);
result.fn = fn;
result.context = context;
@nyteshade
nyteshade / UIImage+WebP.h
Last active November 6, 2018 06:18
This is a friendly class I use in my iOS applications linked with the Google WebP framework. It adds the ability to create any UIImage from WebP encoded imagery. It also attempts to automatically look for an @2x version for retina resolutions. In order to build the libWebP library for iOS, perform a "git clone http://git.chromium.org/webm/libweb…
//
// UIImage+WebP.m
//
// Created by Brielle Harrison <nyteshade@gmail.com>
// Much inspiration for code comes from Carson McDonald
// his website is http://www.ioncannon.net
//
// Portions copyright by Carson McDonald fall under this license
//
// Copyright (c) 2011 Carson McDonald
@nyteshade
nyteshade / Eventable.h
Created July 10, 2013 05:09
Eventables are small pub/sub objects that can be reused. The can listen for any number of custom events and take blocks of code to act upon. Their usage is very simple and hopefully straight forward. I've also tried to provide the ability to pass as much data as necessary for each event action. This code is written to be used with ARC.
//
// Eventable.h
// Copyright (c) 2013 Gabriel Harrison
//
// 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
// furnished to do so, subject to the following conditions:
@nyteshade
nyteshade / niceps1
Last active December 24, 2015 23:09
This is a tool to create a nice UNIX style prompt in full color. Designed for dark backgrounds and a tango color scheme.#!/bin/sh
#!/bin/bash
# Function to determine if this script is being sourced
# or not.
function isSourced() {
if [ "${FUNCNAME[1]}" = source ]; then
echo "true"
else
echo "false"
fi
}
//
// NSObject+Blocks.h
// Filemator
//
// Created by Zachary Waldowski on 4/12/11.
// Copyright 2011 Dizzy Technology. All rights reserved.
//
@interface NSObject (Blocks)
#!/bin/bash
# Tested with wine-1.7.17
# Put this script and the Wildstar.exe installer in a directory
# Edit the VIDEO_MEMORY_SIZE according to your graphic card.
#
# At first launch, use `./winestar.sh install` and keep the default install directory
#
# Once the launcher is downloaded you can simply use ./winestar.sh
#!/bin/bash
# Tested with wine-1.7.17
# Put this script and the Wildstar.exe installer in a directory
# Edit the VIDEO_MEMORY_SIZE according to your graphic card.
#
# At first launch, use `./winestar.sh install` and keep the default install directory
#
# Once the launcher is downloaded you can simply use ./winestar.sh
@nyteshade
nyteshade / side_by_side.css
Created January 27, 2015 06:36
How to do side by side elements, with vertical alignment, without floats
div.left-right {
box-sizing: border-box;
display: inline-block;
font-size: 0;
position: relative;
white-space: nowrap;
width: 100%;
}
div.left-right div.left,
@nyteshade
nyteshade / fork forced sync
Created July 18, 2016 20:10 — forked from glennblock/fork forced sync
Force your forked repo to be the same as upstream.
git fetch upstream
git reset --hard upstream/master
@nyteshade
nyteshade / atom.stylesheet.less
Last active August 2, 2019 08:44
CRT Styling and Feel for the Atom Text Editor
atom-text-editor {
// CRT Styling taken from https://codepen.io/lbebber/pen/XJRdrV
// Begin CRT Styling
background: #121010;
position: relative;
overflow: hidden;
// flicker
&::after {
content: " ";