Skip to content

Instantly share code, notes, and snippets.

View jonathanmarvens's full-sized avatar

Jonathan Barronville jonathanmarvens

View GitHub Profile
@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!';
}
}
function fish_prompt
set last_command_status $status
echo ""
set_color red
echo -n "date:"
set_color normal
echo -n " "
echo -n " "
@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 \
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 () {
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
/*
I've wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace
so it's better encapsulated. Now you can have multiple random number generators
and they won't stomp all over eachother's state.
If you want to use this as a substitute for Math.random(), use the random()
method like so:
var m = new MersenneTwister();
@jonathanmarvens
jonathanmarvens / union-example.c
Last active December 16, 2015 04:09
Today, a friend of mine asked me to show him an example of how one can create a function in C that accepts an argument of different specified types. This example is what I came up with in about 3 minutes while on the phone with him (so it most likely can be better). Needless to say, I used a `union` in order to provide this functionality. Due to…
#include <stdio.h>
#include <string.h>
#define INT_OR_STR_INT 1
#define INT_OR_STR_STR 2
typedef struct
{
unsigned int type;
union
@jonathanmarvens
jonathanmarvens / fork-example.c
Last active December 15, 2015 22:29
C example of using `fork()`.
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int var_global = 0;
int main()
{
int var_local = 0;
pid_t process_id_child = fork();
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.HashMap;
import java.util.Map;
import org.dojotoolkit.json.JSONParser;
import org.dojotoolkit.json.JSONSerializer;
import org.dojotoolkit.rt.v8.V8Exception;
import org.dojotoolkit.rt.v8.V8JavaBridge;
@jonathanmarvens
jonathanmarvens / simple-class.cpp
Created April 5, 2013 21:56
A simple C++ class example I used for teaching a few friends C++.
#include <cctype>
#include <iostream>
class Person
{
public:
std::string getNameFirst();
std::string getNameLast();
void setNameFirst( std::string value );
void setNameLast( std::string value );