Skip to content

Instantly share code, notes, and snippets.

@msurguy
msurguy / eloquent.md
Last active February 8, 2022 03:13
Laravel 4 Eloquent Cheat Sheet.

Conventions:

Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):

class Shop extends Eloquent {}

Using custom table name

protected $table = 'my_shops';

@nils-werner
nils-werner / .bash_completion
Last active December 17, 2015 12:59
Autocompletion for Composer and Artisan
# Put this either in
#
# 1. a new file called ~/.bash_completion
# 2. your ~/.bashrc
#
_composer()
{
local cur=${COMP_WORDS[COMP_CWORD]}
local cmd=${COMP_WORDS[0]}
@chipotle
chipotle / deploy.rb
Last active February 8, 2018 18:54
Capistrano deployment script for Laravel 4
# Capistrano Laravel 4 Deployment Tasks
# Watts Martin (layotl at gmail com)
# https://gist.github.com/chipotle/5506641
# updated 14-Aug-2013
# Assumptions:
#
# - You are using a .gitignore similar to Laravel's default, so your
# vendor directory and composer(.phar) are *not* under version control
# - Composer is installed as an executable at /usr/local/bin/composer
@bzerangue
bzerangue / world-currency-list.xml
Created April 29, 2013 19:57
World currencies list source from themoneyconverter.com. With name of currency, currency code, (unicode symbols for those available), and rss feed locations.
<?xml version="1.0" encoding="UTF-8"?>
<currency source-url="http://themoneyconverter.com">
<entry code="ARS" feed-location="/rss-feed/ARS/rss.xml">
<name>Argentine Peso</name>
<unicode>
<decimal>36</decimal>
<hex>24</hex>
</unicode>
</entry>
<entry code="AWG" feed-location="/rss-feed/AWG/rss.xml">
@bzerangue
bzerangue / currency-symbols.xml
Last active September 27, 2024 03:34
World currencies with their symbols
<?xml version="1.0" encoding="UTF-8"?>
<!--
## SOURCE: xe.com
-->
<currency-symbol count="115">
<entry code="ALL" unicode-decimal="76, 101, 107" unicode-hex="4c, 65, 6b">Albania Lek</entry>
<entry code="AFN" unicode-decimal="1547" unicode-hex="60b">Afghanistan Afghani</entry>
<entry code="ARS" unicode-decimal="36" unicode-hex="24">Argentina Peso</entry>
<entry code="AWG" unicode-decimal="402" unicode-hex="192">Aruba Guilder</entry>
<entry code="AUD" unicode-decimal="36" unicode-hex="24">Australia Dollar</entry>
@designermonkey
designermonkey / next_proposal.md
Last active December 16, 2015 04:58
Draft proposal for the Symphony Next project.
  • Draft Number: 1
  • Date: 2013-04-14
  • Author: John Porter @designermonkey

Symphony Next

This is all still a little new to me, so forgive me if this sounds naive, or you all have already thought about this and it's obvious, but I've been thinking about how we actually build Next. (I like this as a project codename).

Proposing the Application

@bzerangue
bzerangue / array2xml.php
Last active June 28, 2023 04:29
Decoding JSON to a PHP Array and then converting it to XML.
<?php
/**
* Array2XML: A class to convert array in PHP to XML
* It also takes into account attributes names unlike SimpleXML in PHP
* It returns the XML in form of DOMDocument class for further manipulation.
* It throws exception if the tag name or attribute name has illegal chars.
*
* Author : Lalit Patel
* Website: http://www.lalit.org/lab/convert-php-array-to-xml-with-attributes
* License: Apache License 2.0
@bzerangue
bzerangue / recursive-md.php
Last active July 24, 2020 17:39
Recursively search through a directory (and it's children directories) to find Markdown files and convert the list of files and their content and into an XML document.
<?php
#
# INSPIRATION FROM Nick Dunn (in the Symphony CMS forum)
# "Convert a Directory of Markdown Text Files for Dynamic XML Datasource Use"
# http://getsymphony.com/discuss/thread/60701/#position-2
#
# AND FROM Stack Overflow
# http://stackoverflow.com/questions/8545010/php-reading-first-2-lines-of-file-into-variable-and-cylce-through-subfolders/8545451#8545451
#
@krisnoble
krisnoble / deploy.php
Last active April 25, 2023 15:52
A slightly modified version of Brandon Summers' script. For more information: http://simianstudios.com/blog/post/using-bitbucket-for-automated-deployment-of-multiple-repositories
<?php
date_default_timezone_set('Europe/London'); // Set this to your local timezone - http://www.php.net/manual/en/timezones.php
/**
* The root directory where the repos live.
*
* @var string
*/
$root_dir = '/your/root/dir/';
@jasonvarga
jasonvarga / gist:4617311
Created January 24, 2013 03:03
Product Page Model
{!-- Wrapper template --}
{stash:embed:layouts:product}
{!-- Custom field prefix --}
{preload_replace:cf="cf_product_"}
{exp:channel:entries
channel="products"
url_title="{segment_2}"
limit="1"