Skip to content

Instantly share code, notes, and snippets.

@opalfroot
opalfroot / passwordChecker.go
Created April 11, 2017 12:44
Go multilingual password checker
package main
import (
"flag"
"fmt"
"log"
"strings"
"unicode"
"unicode/utf8"
)
@opalfroot
opalfroot / simpletab.js
Created February 7, 2017 10:14
Simple jQuery tab function
$(document).ready(function(){
(function( $ ){
$.fn.tabs = function(selector, targetid) {
$(selector).each(function(){
if($(this).attr("id")!=targetid){
this.style.display = "none"
}else{
$(this).fadeIn(500)
}
})
@opalfroot
opalfroot / poster.py
Last active December 3, 2015 16:30
A simple Python script to post data to a URL + basic auth.
import ssl
from base64 import encodestring as encode64
from httplib import HTTPConnection, HTTPSConnection
from urllib import urlencode
from datetime import datetime
class poster(object):
"""
This class takes care of posting data to a url
@opalfroot
opalfroot / gist:cc727eae83869cb61314
Created July 3, 2015 10:18
Detect IE7 and IE7 Compatability View
if(navigator.userAgent.indexOf("MSIE 7.0") > -1){
if (navigator.userAgent.indexOf("Trident") > -1){
document.write('running in compatability view');
}
else{
document.write('running IE7');
}
}
@opalfroot
opalfroot / ImageUpload_Validator.php
Last active August 29, 2015 14:01
Silverstripe Simple Image Size Upload Validator
<?php
class ImageUpload_Validator extends Upload_Validator{
public $minwidth;
public $minheight;
public function setMinDimensions($width,$height){
if(is_numeric($width) && intval($width)>=0)
$this->minwidth=intval($width);