Skip to content

Instantly share code, notes, and snippets.

View radiosilence's full-sized avatar
🔥

James Cleveland radiosilence

🔥
View GitHub Profile
<?php
/**
* An attempt to make arrays into objects, I guess.
*/
namespace Core;
class Arr {
<?php
$imported_files = array();
$include_paths = array_merge(array(__DIR__), explode(':', ini_get('include_path')));
class ImportError extends \Exception {
public function __construct($class) {
trigger_error(sprintf('Class "%s" was not found in any of available paths.', $class), E_USER_ERROR);
}
}
@radiosilence
radiosilence / gist:713093
Created November 24, 2010 04:05
PHP.tmLanguage
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>comment</key>
<string>TODO:
• Try to improve parameters list syntax – scope numbers, ‘=’, ‘,’ and possibly be intelligent about entity ordering
• Is meta.function-call the correct scope? I've added it to my theme but by default it's not highlighted</string>
<key>fileTypes</key>
<array>
@radiosilence
radiosilence / TwilightMod.tmTheme
Created November 24, 2010 04:06
Mod of twilight, makes braces dark with right tmlanguage
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>Michael Sheets, James Cleveland</string>
<key>name</key>
<string>TwilightMod</string>
<key>settings</key>
<array>
from flask import Flask, request, redirect, url_for, \
abort, render_template, flash
import subprocess, time
import win32con, win32gui, win32process
import os
from SendKeys import SendKeys
DEBUG = True
SECRET_KEY = 'blaahhasdasdasd'
@radiosilence
radiosilence / gist:786571
Created January 19, 2011 18:14
lol at making php like lisp)))))))))))))))))))))))))))))
public function find_by_id($id){
return $this->create_object($this->_storage->fetch(new \Core\Dict(array(
"filters" => new \Core\Li(
new \Core\Filter("id", $id)
)
))));
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>Michael Sheets, James Cleveland</string>
<key>name</key>
<string>TwilightMod</string>
<key>settings</key>
<array>
@radiosilence
radiosilence / TwilightMod.tmTheme
Created February 3, 2011 16:23
my modifications of the twilight theme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>Michael Sheets, James Cleveland</string>
<key>name</key>
<string>TwilightMod</string>
<key>settings</key>
<array>
<pre><?php
class WhirlHasher {
protected $_strength;
protected $_itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
public function __construct($strength=14) {
$this->_strength = $strength;
}
public function hash_password($password, $salt=False) {
<?php
$msg = "Lorem";
// Key that user inputs
$okey = "potato";
// A slow hash is made from this key - 2^14 iterations of whirlpool. Salt is generated automatically and is about 100 characters long.
$hash = $hasher->hash($okey);
// Salt of this hash is taken and stored, so that hash can be re-created with correct original key.
$salt = $hasher->pull_salt($hash);
// Last 32 characters of hash are taken for use as actual key
$key = substr($hash, -32);