Skip to content

Instantly share code, notes, and snippets.

View bkilshaw's full-sized avatar

Brad Kilshaw bkilshaw

View GitHub Profile
@bkilshaw
bkilshaw / 2014_10_12_000000_create_users_table.php
Last active December 9, 2017 19:04 — forked from anonymous/2014_10_12_000000_create_users_table.php
Help getting "invites" to work and clean up code
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.

Keybase proof

I hereby claim:

  • I am bkilshaw on github.
  • I am bkilshaw (https://keybase.io/bkilshaw) on keybase.
  • I have a public key ASCQRMlPvt2gJnoR4OOcO6yCz8lX0iEDHgjnZ38qTXZ0UQo

To claim this, I am signing this object:

if(!Session::has('rand.key')) {
Session::push('rand.key', rand());
}
$seed = Session::get('rand.key');
if(!$request->session()->has('rand.key')) {
$request->session()->push('rand.key', rand());
}
$seed = $request->session()->get('rand.key');
@bkilshaw
bkilshaw / gist:3624949
Created September 4, 2012 18:51
MACVendors.com API :: PHP POST Example
<?php
$mac_address = "FC:FB:FB:01:FA:21";
$url = "http://api.macvendors.com/";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "mac=$mac_address");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@bkilshaw
bkilshaw / gist:3624901
Last active November 15, 2023 19:22
MACVendors.com API :: PHP GET Example
<?php
$mac_address = "FC:FB:FB:01:FA:21";
$url = "https://api.macvendors.com/" . urlencode($mac_address);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
if($response) {
echo "Vendor: $response";
<?php
function query_select_single($query) {
$results = mysql_query($query);
if(mysql_num_rows($results) >= 1) {
return mysql_fetch_assoc($results);
}
return FALSE;
}
?>
index.php -> page_1.php -> page_2.php -> page_3.php
-> page_a.php -> page_b.php
-> page_i.php -> page_ii.php
-> page_x.php -> page_y.php
var http = require("http");
function onRequest(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
console.log(".");
response.end();
}
http.createServer(onRequest).listen(8888);