Skip to content

Instantly share code, notes, and snippets.

View bayleedev's full-sized avatar
🍿

Baylee Schmeisser bayleedev

🍿
View GitHub Profile
@bayleedev
bayleedev / results.html
Created January 29, 2013 22:15
Testing to determine the fastest way to check if a method exists with a specific visibility.
Old: 266.95534920692
New: 132.84537982941
<?php
$start = memory_get_usage();
$a = str_repeat("Hello", 4242);
$middle = memory_get_usage();
$b = $a;
$c = $a;
@bayleedev
bayleedev / Document.php
Last active December 12, 2015 02:38
Update lithium (#li3) performance on read only mongo data when converting it to an array. Things that do not get encoded include: MongoId and MongoDate objects. If a relationship exists, or a the you are using a nosql db, like mongo, anything in an array would also still be in a `DocumentSet`.
<?php
namespace app\extensions\data\entity;
class Document extends \lithium\data\entity\Document {
/**
* Converts the data in the record set to a different format, i.e. an array.
*
* @param string $format currently only `array`
<?php
class foo {
public function &bar(&$bar) {
return ++$bar;
}
public function __call($method, $params) {
return $this->bar($params[0]);
}
@bayleedev
bayleedev / genericSublime.json
Created February 7, 2013 02:14
This are the necessary items for writing code
{
// Displays whitesace on the screen
"draw_white_space": "all",
// Rules are great for soft/hard limits
"rulers":
[
80,
100
],
/**
* Define application view paths
*/
protected function _init() {
$this->_render['renderer'] = 'File';
$this->_render['paths']['template'] = '{:library}/views/{:controller}/';
$this->_render['paths']['template'] .= '{:template}.{:type}.php';
$this->_render['paths']['layout'] = '{:library}/views/layouts/default.{:type}.php';
$this->_render['paths']['element'] = '{:library}/views/elements/{:template}.html.php';
parent::_init();
module LazyEnumerator
include Enumerable
def initialize(data = [])
@data = data
@pointer = 0
end
def each
@bayleedev
bayleedev / truecrypt.java
Created April 5, 2013 01:41
Truecrypt brute force app I made a few years ago.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
class attempt {
private String charset = "abcdefghijklmnopqrstuvwxyz";
private int length = charset.length();
private BufferedReader stdError;
private Process p;
# ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.3.0]
module Baz
def bar
puts "world"
end
end
class Foobar
include Baz
def bar
class Foo
private
def self.bar
puts 'I broke your ruby'
end
end
Foo.bar # I broke your ruby