Skip to content

Instantly share code, notes, and snippets.

/*
sformat(str, arg1, arg2, etc..)
USAGE:
==============================================================
sformat("{0}", "test"); //returns test
sformat("{{0}}"); //returns {0}
sformat("{{{0}}}", "test"); //returns {test}
sformat("{0} {0}", "test"); //returns test test
sformat("{0} {1}", "first", "second"); //returns first second
@ricardo-rossi
ricardo-rossi / StackScript-LAMP
Created September 17, 2014 14:31
StackScript (LAMP)
#!/bin/bash
# This block defines the variables the user of the script needs to input
# when deploying using this script.
#
# <UDF name="hostname" label="The hostname for the new Linode.">
# <UDF name="username" label="Add a user account to add to sudo">
# <UDF name="password" label="The sudo user's password">
# <UDF name="db_password" Label="MySQL root Password" />
# <UDF name="db_name" Label="Database Name" default="" example="Create this database" />
# <UDF name="db_name2" Label="Database 2 Name" default="" example="Create this database" />
@ricardo-rossi
ricardo-rossi / .vimrc
Last active August 29, 2015 14:06
.vimrc
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=/etc/vim/bundle/vundle
call vundle#begin('/etc/vim/bundle') " Use a shared folder
set number
set mouse=a
set term=xterm-256color
@ricardo-rossi
ricardo-rossi / StripeBilling.php
Created September 18, 2014 19:34
Laravel Adapter for Stripe Billing
<?php namespace Endata\Billing;
use Stripe;
use Stripe_Charge;
use Stripe_Customer;
use Stripe_InvalidRequestError;
use Stripe_CardError;
use Config;
use Exception;
@ricardo-rossi
ricardo-rossi / SampleLoader.php
Created September 18, 2014 19:42
Loads sample data into database
<?php namespace Endata\Data;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;
use Ingredient;
use Nutrient;
use Composition;
use Settings;
use Plant;
use Formula;
@ricardo-rossi
ricardo-rossi / MailingList.php
Created September 18, 2014 19:50
This class handles adding new users our MailChimp mailing list as well as updating the list entry based on actions
<?php namespace Endata\Lists;
use MailChimp;
use Carbon\Carbon;
class MailingList {
protected $mailchimp;
protected $list_id = 'MCIDXXX'; // The MailChimp list id
<?php
class IngredientTypesController extends BaseController {
/**
* Ingredient Types Repository
*
* @var IngredientType
*/
protected $type;
<?php
class Nutrient extends BaseModel {
protected $guarded = array();
public static $rules = array(
'name' => 'required',
'unit' => 'required'
);
@ricardo-rossi
ricardo-rossi / gist:fd15902864d47696b9d5
Last active August 29, 2015 14:10
Pretty git log script
#!/bin/sh
while true;
do
clear
git log \
--graph \
--all \
--color \
--date=short \
-40 \
@ricardo-rossi
ricardo-rossi / build.sh
Created December 21, 2015 22:49 — forked from patrickarlt/build.sh
ES 7 async/await demo!
babel github-es6.js -o github.js --optional runtime --experimental