Skip to content

Instantly share code, notes, and snippets.

View scottoffen's full-sized avatar
💭
Live in SLC

Scott Offen scottoffen

💭
Live in SLC
View GitHub Profile
@scottoffen
scottoffen / linker.html
Created July 2, 2014 21:25
HTML page to make links to resources you want to download with a right click
<!doctype html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>Save URL Contents</title>
<style type="text/css">
body
{
@scottoffen
scottoffen / comments.pl
Created July 10, 2014 23:59
Perl References
#----------------------------------#
# localtime() array reference #
#----------------------------------#
# 0 - seconds #
# 1 - minutes #
# 2 - hours #
# 3 - day of month #
# 4 - month #
# 5 - year #
# 6 - day of week #
@scottoffen
scottoffen / jquery.styleexists.js
Last active August 29, 2015 14:06
jQuery namespaced function to determine if a css selector is defined in any attached stylesheet
(function ($)
{
$.styleExists = function (s)
{
var exists = false;
var stylesheets = document.styleSheets;
for (var sx = 0, sl = stylesheets.length; sx < sl; sx += 1)
{
var sheetclasses = stylesheets[sx].rules || document.styleSheets[sx].cssRules;
@scottoffen
scottoffen / barspacing.js
Created October 21, 2014 17:13
Javascript Exponential Bar Spacing
barMargin = (150 * Math.exp(-0.15 * array.length))
@scottoffen
scottoffen / MyRESTResource.cs
Last active August 29, 2015 14:08
A RESTResource extension for handling JSON
public abstract class MyRESTResource : RESTResource
{
protected JObject GetJsonPayload(HttpListenerRequest request)
{
try
{
string data = this.GetPayload(request);
if (!object.ReferenceEquals(data, null))
{
JObject json = JObject.Parse(data);
@scottoffen
scottoffen / plugin-template.js
Last active August 29, 2015 14:10
A jQuery Plugin Template
(function ($, undef)
{
// Function and variables defined in here that do not get
// attached to $ will be scoped to this function, effectively
// making them private.
$fn.plugin = function (options)
{
options = $.extend($.plugin.options, options);
@scottoffen
scottoffen / VirtualHost.md
Last active August 29, 2015 14:10
Modifying VirtualHost using EasyApache

WHMs EasyApache

Solution Used

Custom Directives Outside of a VirtualHost Tag

I created a copy of vhost.default at /var/cpanel/templates/apache2 named vhost.local, found the first line listed below and added the second line below it.

@scottoffen
scottoffen / apidocs.pl
Created February 4, 2015 15:49
Perl Swagger Resource Listing Generator
#!C:\lang\perl\bin\perl.exe
#!/usr/bin/perl -T
use strict;
use warnings;
use Fcntl qw(:flock);
use Try::Tiny;
use Cwd;
use JSON::PP;
@scottoffen
scottoffen / Example-User.pm
Created February 5, 2015 18:20
Example Perl module for a User table using Metaphor
package Example::User;
our $VERSION = '1.0.0';
#########################################||#########################################
# #
# Example::User #
# © Copyright Information and Link To Authors Site Goes Here #
# #
#########################################||#########################################
@scottoffen
scottoffen / map-world.pl
Last active August 29, 2015 14:18
Use Perl to create an AutoHotKey (ahk) macro that will run and build out your Minecraft world map
#!c:\lang\perl\bin\perl.exe
use strict;
use warnings;
use Fcntl qw(:DEFAULT :flock);
# How high you want to be teleported
my $y = 200;
# The x offset for the center of the map
my $offx = 1000;