Skip to content

Instantly share code, notes, and snippets.

View allada's full-sized avatar

Nathan (Blaise) Bruer allada

View GitHub Profile
<?php
abstract class Model{
public static function invokeHook($hookName, $context, $caller, array $args){
// This example talks through traits and executes hook functions
foreach((new ReflectionClass(get_called_class()))->getTraits() as $trait){
foreach($trait->getMethods() as $method){
if($method->class . '_' . $hookName == $method->name){
// Found something to hook onto execute it in context
if(($return = $method->invokeArgs($context, $args)) !== null){
return $return;
<?php
function findset($s, $l){
$len = count($s);
$outAry = array();
$ptrs = array();
for($i=0;$i<$l;$i++){
$ptrs[] = $i;
}
$i=0;
$curPtr = $l-1;
<?php
class Model{
private static $hookInstalls = array();
public function addHook($hookName, $id, Closure $closure){
// Code to add closure to static::$hookInstalls
}
public $id;
// Updates when record is updated
public function update(){
if(($r = static::runHooks('beforeUpdate', $this)) !== null){
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
<!-- images are determined by width and height. The following are supported -->
<splash src="res/screen/ios/Default~iphone.png" width="320" height="480"/>
<splash src="res/screen/ios/Default@2x~iphone.png" width="640" height="960"/>
<splash src="res/screen/ios/Default-Portrait~ipad.png" width="768" height="1024"/>
<splash src="res/screen/ios/Default-Portrait@2x~ipad.png" width="1536" height="2048"/>
<splash src="res/screen/ios/Default-Landscape~ipad.png" width="1024" height="768"/>
<splash src="res/screen/ios/Default-Landscape@2x~ipad.png" width="2048" height="1536"/>
<splash src="res/screen/ios/Default-568h@2x~iphone.png" width="640" height="1136"/>
<splash src="res/screen/ios/Default-667h.png" width="750" height="1334"/>
<splash src="res/screen/ios/Default-736h.png" width="1242" height="2208"/>
package main
import (
"net/http"
"io"
"time"
"golang.org/x/net/websocket"
"golang.org/x/net/http2"
)
function extract(data) {
var findTestFunction = /(\s*function\s+)test\s*\(([^)]*)\)(\s*{?)/;
data = data.replace(findTestFunction, "$1innerTest($2)\$3");
var findBody = /<body(?:\s+[^>]*)?>([\s\S]*)<\/body>/;
body = data.match(findBody)[1];
var findScriptsFunction = /<script\s+.*src="([^"]+)"/g
var match;
var scripts = [];
while (match = findScriptsFunction.exec(data)) {
scripts.push(match[1]);
@allada
allada / ipv6.cc
Last active November 7, 2016 01:55
#include <string>
int base16Pows[] = {
0x1,
0x10,
0x100,
0x1000,
0x10000
};
@allada
allada / getStatus.js
Last active November 15, 2023 06:33
const ethers = require('ethers');
const process = require('process');
// Delay to wait to calculate blocks per second in seconds.
const delay = 60 * 60;
// To run:
// node getStatus.js /path/to/bsc/node/geth.ipc
async function run() {
const path = process.argv[2];
@allada
allada / proxy.js
Created June 18, 2021 07:53
Proof
const ethers = require('ethers');
const WebSocket = require('ws');
const endPoints = [
'ws://127.0.0.1:49011',
'ws://127.0.0.1:49012',
'ws://127.0.0.1:49013',
'ws://127.0.0.1:49014',
'ws://127.0.0.1:49015',
'ws://127.0.0.1:49016',