Skip to content

Instantly share code, notes, and snippets.

View jonathanmarvens's full-sized avatar

Jonathan Barronville jonathanmarvens

View GitHub Profile
# Initial setup
git clone -o framework -b develop https://github.com/laravel/laravel.git project-name
cd project-name
git checkout --orphan master
git commit -m "Initial commit"
# Pulling changes
git fetch framework
git merge --squash -m "Upgrade Laravel" framework/develop
# Fix merge conflicts if any and commit
/**
* @author Jonathan Barronville
* @example
* var color_001 = colorShader( '000000', 255 );
* // color_001 === 'ffffff';
* var color_002 = colorShader( 'ffffff', -255 );
* // color_002 === '000000';
* @param {String} color_hex
* @param {Number} amount
* @return {String}
if ( ! (
Object.create &&
( {} ).toString.call( Object.create ) === '[object Function]'
) ) {
Object.create = function ( members ) {
function Class() {}
Class.prototype = members;
return ( new Class() );
|---------|
|-----------------|
| |
|-------------------------|
| |
| |
__ |---------------------------------| __
|| | | ||
\--|===| --------- |===|--/
|==| |==|
@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 );
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 / 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();
@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
/*
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();
---
# ^^^ 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.