Skip to content

Instantly share code, notes, and snippets.

View jonathanmarvens's full-sized avatar

Jonathan Barronville jonathanmarvens

View GitHub Profile
if (! Function.prototype.bind) {
Function.prototype.bind = function bind(context_this) {
if (Object.prototype.toString.call(this) === "[object Function]") {
var
arguments_trimmed = Array.prototype.slice.call(arguments, 1),
function_to_bind = this,
function_noop = function () {}
;
var function_bound = function () {
@jonathanmarvens
jonathanmarvens / laravel-environment.sh
Last active December 19, 2015 13:49
Only use this for development VMs! I've warned you!!!
sudo add-apt-repository -y ppa:ondrej/php5
sudo add-apt-repository -y ppa:ondrej/mysql
sudo aptitude -y update
sudo aptitude -y install apache2-mpm-prefork
sudo aptitude -y install \
libapache2-mod-php5 \
php-apc \
php-pear \
php5-cli \
php5-common \
function fish_prompt
set last_command_status $status
echo ""
set_color red
echo -n "date:"
set_color normal
echo -n " "
echo -n " "
@jonathanmarvens
jonathanmarvens / app.controllers.UserController.php
Last active December 19, 2015 20:49
Browsing to `http://<your_app_domain>/` should now redirect (HTTP 302) you to `http://<your_app_domain>/users/login`.
<?php
class UserController extends \BaseController {
public function getLogin() {
return 'I\'m in!';
}
}
<?php
class BaseController extends Controller {
private $application_name = 'The Cool Kid';
protected $layout = 'base';
// The cool kids' way of handling page titles.
protected $title = array(
'parent' => '',
'seperator' => '::',

Problem 1

Use JavaScript to write a function that takes a number as its argument. If the number is less than 10, the function should return "small"; if the number is 10 or greater, but less than 100, the function should return "medium"; if the number is 100 or greater, the function should return "large".

Problem 2

Use JavaScript to write a function that takes a number as its argument. If the number is between 1 and 10 (inclusive), return the word for that number (that is, if the number passed to the function is 2, return the word "two"). If the number is not between 1 and 10, return false.

<?php
// Resizer and Image Manipulation
// Based on: http://forums.laravel.com/viewtopic.php?id=2648
public function post_edit_logo($id)
{
$rules = array(
'image' => 'image',
);
def __constructor(*arguments, **keyword_arguments):
current_instance = arguments[0]
current_class = eval(current_instance.__class__.__name__)
parent_class = super(current_class, current_instance)
parent_class.__init__(*arguments[1:], **keyword_arguments)
__members = {
"__init__": __constructor,
}
( function () {
var DEFAULT_ENCODING_BASE = 2;
function _properBase( base ) {
if ( ! ( base === 2 || base === 16 ) ) {
base = DEFAULT_ENCODING_BASE;
}
return base;
}
@jonathanmarvens
jonathanmarvens / contracting-rate-info.js
Last active September 29, 2017 22:51
Use this little Gist to calculate your contracting rate information. It's a very simple formula. Note: *YMMV* ... my formula may or may not work for you.
function contractingRateInfo( options ) {
var
committed_days,
committed_days_cost,
committed_hours,
committed_hours_cost,
hourly,
weekly
;