Skip to content

Instantly share code, notes, and snippets.

@efreed
efreed / bookmarklet.js
Last active August 29, 2015 13:59
flash maximize
if (window.foundFlashSrc) {
document.location = window.foundFlashSrc;
}
function getLargest(tagname) {
var largestObject = false
, largestArea = -1
, i = 0
, objects = document.getElementsByTagName(tagname)
, thisArea = 0;
@efreed
efreed / install.html
Last active August 29, 2015 14:00
Google Search Results Mockup Bookmarklet
<!DOCTYPE html>
<html>
<head>
<title>Install and use the Google Results Mockup Bookmarklet</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
a.bookmarklet {
display: -moz-inline-box;
display: inline-block;
padding: 1px 6px;
@efreed
efreed / prd.php
Last active November 1, 2017 16:35
print_r; die;
/**
* print_r and die. Pass any number of params, each one will be separated by an hr
**/
function prd() {
while(ob_get_level())
ob_end_flush();
foreach (func_get_args() as $i => $arg) {
echo $i?'<hr>':'<pre>';
if ($arg === null) echo '<span style="background-color:#333;color:#FFF;">null</span>';
else if ($arg === true) echo '<span style="background-color:#333;color:#FFF;">true</span>';
@efreed
efreed / errorlog.php
Created June 9, 2014 18:27
Apache error log UI
// No configuration needed, will automatically find the Apache log folder and read error.log
// Initialy displays the last 2k of contents and auto updates (and auto scrolls) as new lines show up
// Can enter a search phrase in the UI to ignore any new lines that do (or don't) contain the phrase
$tail = new PHPTail(GetApacheLogPath());
if(isset($_GET['ajax'])) { //We're getting an AJAX call
echo $tail->getNewLines($_GET['lastsize'], $_GET['grep'], $_GET['invert']);
exit();
}
// Regular GET/POST call, print out the GUI
@efreed
efreed / account-t1.php
Last active August 29, 2015 14:05 — forked from kyfreed/account-t1.php
File-based PHP login system
<?php
include 'accountfunctions.php';
requireUser('t1');
?>
@efreed
efreed / AsFraction.js
Created September 1, 2014 05:41
Javascript decimal-to-fraction
/*
* Will convert a float to an html fraction, guessing denominators up to 16. Handles errors from rounding to 2 decimals.
*/
function AsFraction(num) {
if (num == "" || isNaN(num)) // sanity check
return num;
var int = Math.floor(num)
, decimal = num - int;
if (decimal < 0.005) // whole number, don't show fraction
return int;
@efreed
efreed / doxygen_integration
Last active June 20, 2016 18:01
Wordpress plugin to read zip'd website into a shortcode
<?php
/**
* Plugin Name: DoxyGen Integration
* Plugin URI: http://www.fivetalent.com/
* Description: Enables shortcodes to embed a doxygen site into a page
* Version: 1.0
* Author: Eric Freed / Five Talent
*/
@efreed
efreed / put_sample
Created June 29, 2015 17:16
S3 REST
class OdysysCache {
protected $_key = 'abc';
protected $_secret = 'abc123xyz';
protected $_bucket = 'odysyscache';
/**
* Write a file to the S3 Bucket
* @param String $file_name
* @param mixed $file_data
* @param String $file_type Optional MIME type, or will be auto set from the file extention
@efreed
efreed / AWS Account Init.txt
Last active September 22, 2018 06:13
AWS Web Server
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/get-set-up-for-amazon-ec2.html
(in the IAM section)
Create New Group called "Administrators" (with the AdministratorAccess policy)
Create IAM users and add to the group
In the "dashboard" section, edit the account alias to make *alias*.signin.aws.amazon.com/console
On the IAM homepage, finish the 5 security steps
(in the EC2 section)
@efreed
efreed / kov.js
Created November 20, 2017 16:03
Knockout Helpers
/**
* Lookup the observable object or value of a field safely no matter if it is static or observable or even exists
* @syntax kov([scope,]period_delimited_lookup_string[,ifmissing])
* @returns value or ifmissing
* @author Eric Freed
*/
function kov(a, b, c, orig_f, orig_scope) {
try {