Skip to content

Instantly share code, notes, and snippets.

View mhakes's full-sized avatar

Matt Hakes mhakes

View GitHub Profile
@scriptify
scriptify / schroedinger.js
Last active December 18, 2018 10:06
If you don't debug the function using console.log, it throws an unexpected error. But as soon as you want to debug it, it works like a charm (I recently had an occurence like this, and instead of fixing the bug, I needed to create this gist as a joke). "Works" for every global function you create in the browser. Just copy and paste this code int…
function notFunny() {
function s(fn = () => {}) {
return () => {
const fnStr = fn.toString();
console.log(fnStr);
const keywords = ['console', 'debugger'];
if (!keywords.find(key => fnStr.includes(key)))
throw new Error(`Uncaught ReferenceError: ${fn.toString().slice(0, 10)} is not defined`);
fn();
}
This file has been truncated, but you can view the full file.
*M-UNKNOWN MEXICAN TRUCKING COMPANY
8CON CONTSHIP CONTAINER LINE
99M UNKNOWN MEXICAN OVERLAND CARRIER
AAAB AAA MOTORS
AAAC AAACTION TRANSPORTATION INC
AAAD A A A DELIVERY INC
AAAG ATC LOGISTICS INC
AAAO AAMODT INC
AAAU ASIA CONTAINER LEASING CO LTD
AAAW AAA WALKER TRANSPORTATION SERVICES
@cballou
cballou / get-ip-address-optimized.php
Created March 26, 2012 00:51
PHP - Advanced Method to Retrieve Client IP Address
<?php
function get_ip_address() {
$ip_keys = array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR');
foreach ($ip_keys as $key) {
if (array_key_exists($key, $_SERVER) === true) {
foreach (explode(',', $_SERVER[$key]) as $ip) {
// trim for safety measures
$ip = trim($ip);
// attempt to validate IP
if (validate_ip($ip)) {