Skip to content

Instantly share code, notes, and snippets.

$TTL 60
$ORIGIN dev.
@ 1D IN SOA localhost. root.localhost. (45 3H 15M 1W 1D)
1D IN NS localhost.
1D IN A 127.0.0.1
*.dev. 60 IN A 127.0.0.1
go.dev. 60 IN A 127.0.0.1
*.go.dev. 60 IN A 127.0.0.1
@jonnyreeves
jonnyreeves / index.html
Created April 23, 2012 21:38
JavaScript Class Structure using requireJS. The following code shows you how to create a Class definition in one JavaScript file and then import it for use in another; coming from an ActionScript 3 background this (and some of JavaScript specific traits)
<!DOCTYPE html>
<html>
<head>
<script data-main="usage" src="http://requirejs.org/docs/release/1.0.8/comments/require.js"></script>
</head>
<body>
<p>Check your JavaScript console for output!</p>
</body>
</head>
@merk
merk / Menu.php
Created May 7, 2012 03:15
Event driven menus
<?php
/*
* TODO: Copyright notices on Infinite Networks files.
*
* (c) Infinite Networks Pty Ltd <http://www.infinite.net.au/>
*/
namespace Infinite\MenuBundle\Menu;
@maxrice
maxrice / us-state-names-abbrevs.php
Created May 23, 2012 18:32
US State Names & Abbreviations as PHP Arrays
<?php
/* From https://www.usps.com/send/official-abbreviations.htm */
$us_state_abbrevs_names = array(
'AL'=>'ALABAMA',
'AK'=>'ALASKA',
'AS'=>'AMERICAN SAMOA',
'AZ'=>'ARIZONA',
'AR'=>'ARKANSAS',
@Ocramius
Ocramius / User.php
Last active July 24, 2024 14:38
Doctrine 2 ManyToMany - the correct way
<?php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity()
* @ORM\Table(name="user")
*/
class User
@baldurrensch
baldurrensch / gist:3363685
Created August 15, 2012 21:05
Credit Card Model class
<?php
namespace Acme\DV2Bundle\Model;
use Acme\DV2Bundle\Exception\UnsupportedCreditCardTypeException;
use Acme\DV2Bundle\Exception\UnknownCreditCardTypeException;
/**
* Acme\DV2Bundle\Entity\CreditCard
*/
@baldurrensch
baldurrensch / gist:3363726
Created August 15, 2012 21:12
Credit Card Unit Tests
<?php
namespace Acme\DV2Bundle\Tests\Model;
use Acme\DV2Bundle\Model\CreditCard;
class CreditCardTest extends \PHPUnit_Framework_TestCase
{
public function testMod10()
{
@merk
merk / JobController.php
Last active October 10, 2015 14:17
Use of a FormType to build a filter for a list of entities
<?php
namespace Ibms\JobBundle\Controller;
class JobController extends BaseJobController
{
/**
* Job list.
*
* @param \Symfony\Component\HttpFoundation\Request $request
@jmolivas
jmolivas / gist:3954344
Created October 25, 2012 18:00
Twig template code - Displaying flash messages using bootstrap
{# twig template #}
<div class="flash-messages">
{% block flashes %}
{% for notice_level in ['success','error','info', 'warning', 'notice'] %}
{% if app.session.hasFlash(notice_level) %}
<div class="alert alert-{{ notice_level }}">
<a class="close" data-dismiss="alert" href="#">x</a>
<h4 class="alert-heading">{{ notice_level }}</h4>
{{ app.session.flash(notice_level) }}
@bjo3rnf
bjo3rnf / EntityHiddenType.php
Last active November 19, 2021 17:19
Hidden field for Symfony2 entities
<?php
namespace Dpn\ToolsBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Dpn\ToolsBundle\Form\DataTransformer\EntityToIdTransformer;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Doctrine\Common\Persistence\ObjectManager;