Skip to content

Instantly share code, notes, and snippets.

View marcus-at-localhost's full-sized avatar
💭

Marcus marcus-at-localhost

💭
View GitHub Profile
@marcus-at-localhost
marcus-at-localhost / AddressHelper.php
Created January 1, 2018 23:23 — forked from jonathonbyrdziak/AddressHelper.php
Parse Address :: This function is designed to parse a complete street address using PHP. If it can't figure out the parsing itself, then it sends the address to google to have google parse the street address.
<?php
/**
* @author Jonathon Byrd
* @package Address Parsing
*
*
*/
class AddressHelper extends ObjectBase
{
/**
@marcus-at-localhost
marcus-at-localhost / scrape.php
Created September 23, 2017 10:01 — forked from jongacnik/scrape.php
Tumblr image scrape
<?php
$offset = 0;
$count = 50;
$domain = $argv[1];
$tagged = isset($argv[2]) ? $argv[2] : false;
$api = 'http://' . $domain . '.tumblr.com/api/read/json?debug=1&num=' . $count . ($tagged ? '&tagged=' . $tagged : '');
function scrape ($api, $count, $offset) {
@marcus-at-localhost
marcus-at-localhost / batchparams.bat
Last active July 25, 2017 11:01 — forked from zed/batchparams.bat
Paths in batch files
@echo off
:: http://weblogs.asp.net/jgalloway/archive/2006/11/20/top-10-dos-batch-tips-yes-dos-batch.aspx
echo %%~1 = %~1
echo %%~f1 = %~f1
echo %%~d1 = %~d1
echo %%~p1 = %~p1
echo %%~n1 = %~n1
echo %%~x1 = %~x1
echo %%~s1 = %~s1
echo %%~a1 = %~a1
@marcus-at-localhost
marcus-at-localhost / Find a center point of multiple lat lng on Google Maps.php
Created May 17, 2017 05:49
Find a center point of multiple lat lng on Google Maps
<?php
// Find a center point of multiple lat lng on Google Maps
// $data = [
// 0 => [-8.412942,115.238952],
// 1 => [-8.800293,115.160986]
// ];
function GetCenterFromDegrees($data)
{
if (!is_array($data)) return FALSE;
@marcus-at-localhost
marcus-at-localhost / genColorCodeFromText.php
Created May 2, 2017 14:24 — forked from mrkmg/genColorCodeFromText.php
Generate a unique color based on text input
<?php
/*
* Outputs a color (#000000) based Text input
*
* @param $text String of text
* @param $min_brightness Integer between 0 and 100
* @param $spec Integer between 2-10, determines how unique each color will be
*/
function genColorCodeFromText($text,$min_brightness=100,$spec=10)
<?php
require_once 'Zend/Feed/Writer/Feed.php';
/**
* Create the parent feed
*/
$feed = new Zend_Feed_Writer_Feed;
$feed->setTitle('Paddy\'s Podcast');
@marcus-at-localhost
marcus-at-localhost / disposable-email-provider-domains
Last active January 13, 2017 22:40
List of disposable email provider domains
0815.ru
0clickemail.com
0-mail.com
0wnd.net
0wnd.org
0x00.name
10mail.org
10minut.com.pl
10minutemail.co.za
10minutemail.com
@marcus-at-localhost
marcus-at-localhost / trim.awk
Created January 10, 2017 16:36 — forked from andrewrcollins/trim.awk
ltrim(), rtrim(), and trim() in awk
function ltrim(s) { sub(/^[ \t\r\n]+/, "", s); return s }
function rtrim(s) { sub(/[ \t\r\n]+$/, "", s); return s }
function trim(s) { return rtrim(ltrim(s)); }
BEGIN {
# whatever
}
{
# whatever
}
END {
@marcus-at-localhost
marcus-at-localhost / info.md
Last active December 26, 2016 11:57 — forked from eltonmesquita/onViewport.js
A simple jQuery function that adds a class when the target(s) is in the viewport

Use like this:

// Call the function with the following parameters:
onViewport(selector, classNameToBeAdded, offset, callback);

// Example:
onViewport(".about-section", "active", 300, function() {
  console.log("This is not a drill.")
});
@marcus-at-localhost
marcus-at-localhost / baseTagRelativeLinkFixer.js
Created November 14, 2016 22:39 — forked from EdwardCoyle/baseTagRelativeLinkFixer.js
Fixes references to inline SVG elements when the <base> tag is in use.
/**
* SVG Fixer
*
* Fixes references to inline SVG elements when the <base> tag is in use.
* Firefox won't display SVG icons referenced with
* `<svg><use xlink:href="#id-of-icon-def"></use></svg>` when the <base> tag is on the page.
*
* More info:
* - http://stackoverflow.com/a/18265336/796152
* - http://www.w3.org/TR/SVG/linking.html