Skip to content

Instantly share code, notes, and snippets.

View SeanJA's full-sized avatar
🦑
🦖

SeanJA SeanJA

🦑
🦖
View GitHub Profile
version: '3'
tasks:
up:
desc: "Start up all of the containers"
aliases: [u, start]
cmds:
- cmd: docker-compose up -d
stop:
desc: "Stop all of the containers"
{
"level101":[
{
"lvl101_name": "Network_Basics",
"lvl101_type": "Online",
"lvl101_duration": 720
},
{
"lvl101_name": "Intro_To_Software",
"lvl101_type": "On-Site",
<?php
/**
* Looks for unquoted keys in a json string and fixes them ie: {a:"b"} => {"a":"b"}
* @param string $string A json string that is suspect
* @return string A valid json string
*/
function fix_json($string){
// (no qupte) (word) (no quote) (semicolon)
$regex = '/(?<!")([a-zA-Z0-9_]+)(?!")(?=:)/i';
@SeanJA
SeanJA / GIFEncoder.class.php
Last active November 8, 2021 17:39
dynamic animated gif clock
<?php
/*
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Formerly known as:::
:: GIFEncoder Version 2.0 by László Zsidi, http://gifs.hu
::
:: This class is a rewritten 'GifMerge.class.php' version.
::
:: Modification:
@SeanJA
SeanJA / form-check.js
Created August 22, 2013 03:19
check if you are connected and you don't have a dead battery.
$('.my-form').submit(function(){
var battery = window.navigator.battery.level <= 0.05;
var connectivity = window.navigator.onLine;
var msg = '';
if(!battery){
msg = "you should probably plug in your computer";
}
if(!battery && !connectivity){
msg += ", "
}
@SeanJA
SeanJA / JSDebug.php
Created September 30, 2011 16:01
debugging in the console from php
<?php
/**
* @method void error() error(string $name, mixed $var)
* @method void exception() exception(string $name, mixed $var)
* @method void info() info(string $name, mixed $var)
* @method void log() log(string $name, mixed $var)
* @method void trace() trace(string $name, mixed $var)
* @method void warn() warn(string $name, mixed $var)
@SeanJA
SeanJA / svn2git-authors.sh
Created March 23, 2011 13:23
generate a git-style authors list out of svn logs
usage:
cd /my/svn/repo
./path/to/svn2git-authors.sh > authors.txt
@SeanJA
SeanJA / 1.json
Created June 18, 2012 04:17
a simple json file migration for the drupal 7 (maybe 6?) migrate module
{
"title": "this is a title",
"content": "this is a body",
"date": "2009-01-01",
"url":"http://oldsite.com/123/test",
"image": "test.jpg",
"id": 1
}
@SeanJA
SeanJA / time.php
Created November 28, 2012 23:17
put the characters in the right places
<?php
//made up x start positions... obviously, I think they are a pixel offset?
//days
$text = $interval->format('%D');
imagettftext ($image , $font['size'] , $font['angle'] , 10 , $font['y-offset'] , $font['color'] , $font['file'], $text );
//separator
$text = $interval->format(':');
/**
* Here an example using servlet 3.0 to upload file with file-uploader
*/
package com.silyan.simplex.view.site.content;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;