Skip to content

Instantly share code, notes, and snippets.

@julien-c
julien-c / global.php
Last active December 16, 2015 16:09
Sentry/Monolog integration in Laravel 4
<?php
if (Config::has('sentry.key')) {
$bufferHandler = new Monolog\Handler\BufferHandler(
new Monolog\Handler\RavenHandler(
new Raven_Client(Config::get('sentry.key')),
Monolog\Logger::WARNING
)
);
@vsavkin
vsavkin / exampe.rb
Last active February 1, 2018 10:15
Example of using EDR
#somewhere in a controller
CreateOrder.new(OrderRepository).create current_user, params
# where
class CreateOrder < UseCaseService
def initialize order_repo
@order_repo = order_repo
@Ocramius
Ocramius / PostEntity.php
Created August 5, 2013 19:47
Example "manual" hydration with ZF2 and a Doctrine loaded entity
<?php
class PostEntity
{
private $id;
private $user;
private $title;
private $content;
private $date;
@hellysmile
hellysmile / repositories.py
Last active February 3, 2023 22:27
django repository pattern
from django.contrib.sites.models import Site
class Object(object):
def __init__(self, model, key):
self.model = model
self.key = key
def __call__(self, *args, **kwargs):
params = {}
@jayuen
jayuen / gist:6787780
Created October 2, 2013 01:22
DateWithTimezone
define("DateWithTimezone", function(module) {
var DateWithTimezone = function(moment){
this.moment = moment
moment.tz(DateWithTimezone.getTimezone())
}
_.extend(DateWithTimezone.prototype, {
toISO: function(){
return this.format()
},
@electblake
electblake / nginx.conf.erb
Created October 29, 2013 22:46
Laravel 4 nginx Config for use in /conf of your heroku app. Read More at: https://github.com/iphoting/heroku-buildpack-php-tyler
## Customized for Laravel 4
# setting worker_processes to CPU core count
worker_processes 1;
daemon off;
events {
worker_connections 1024;
}
/**
* User
*
* @module :: Model
* @description :: A short summary of how this model works and what it represents.
*
*/
var uuid = require('node-uuid')
var bcrypt = require('bcrypt')
, SALT_WORK_FACTOR = 10
@niallobrien
niallobrien / Vagrantfile
Last active January 1, 2016 14:38
Install script for Laravel #php development. Node.js and Ruby included.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
@mikermcneil
mikermcneil / isValidationError.js
Created January 11, 2014 02:09
hack to determine whether an error is a validation error from waterline (for Sails/Waterline 0.9.x)
var _ = require('lodash');
/**
* `isValidationError`
*
* Is this a waterline validation error?
*/
function isWaterlineValidationError (err) {
if (_.isPlainObject(err)) {
@auser
auser / main.spec.js
Created January 14, 2014 08:44
Gist that sits alongside the protractor post at http://www.ng-newsletter.com/posts/practical-protractor.html
describe('e2e: main', function() {
var ptor;
beforeEach(function() {
browser.get('/');
ptor = protractor.getInstance();
});
it('should load the home page', function() {