Skip to content

Instantly share code, notes, and snippets.

View theshane's full-sized avatar

Shane Burgess theshane

View GitHub Profile
@theshane
theshane / test.pl
Created July 14, 2011 12:00
Testing
sub getFirstEmail{
my $email = shift;
if($email){
if($email =~ /,/){
my @emails = split(',',$email);
$email = $emails[0];
}
}
return $email;
@theshane
theshane / LoginRequiredMiddleware.py
Last active February 22, 2017 01:41 — forked from r0yfire/LoginRequiredMiddleware.py
Django Login Required Middleware (Updated for 1.10)
from re import compile
from django.conf import settings
from django.http import HttpResponseRedirect
from django.utils.http import is_safe_url
from django.utils.deprecation import MiddlewareMixin
EXEMPT_URLS = [compile(settings.LOGIN_URL.lstrip('/'))]
if hasattr(settings, 'LOGIN_EXEMPT_URLS'):
EXEMPT_URLS += [compile(expr) for expr in settings.LOGIN_EXEMPT_URLS]
@theshane
theshane / dbic_in.pl
Created February 22, 2017 02:06
HOW TO DO ‘IN’ AND ‘NOT IN’ IN DBIX::CLASS
my $search = $schema>resultset('Table')->search(
{ column_1 => { 'in' => [ 105, 106, 73, 74, 99, 75 ] },
column_2 => { 'not in' => [ 45,25,28] },
column_3 => { 'not in' => \@array}
}
);
@theshane
theshane / angularWebsocketFactory.js
Created February 22, 2017 02:08
ANGULAR WEBSOCKET FACTORY
(function() {
'use strict';
angular
.module('serviceRequest')
.factory('webSocket', webSocket);
/* @ngInject */
function webSocket($rootScope,$timeout) {
var socket;
@theshane
theshane / gist:9be06acd19db6adea60f8997fa51ab5c
Created June 3, 2019 13:21
Michigan Campsite Watcher (Need Tampermonkey for Chrome)
// ==UserScript==
// @name Mi Campsite Watcher
// @namespace https://www.midnrreservations.com/create-booking
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.midnrreservations.com/create-booking/*
// @grant none
// ==/UserScript==
@theshane
theshane / gist:44b9d2d77a8ec3f070195433da1bc317
Created February 18, 2021 20:46
React Native Background Fade In
import React, {ReactElement, ReactNode, useEffect, useRef} from 'react';
import {
Pressable,
Animated,
Dimensions,
} from 'react-native';
export interface FadedBGProps {
testID?: string;
onPress?: () => void;