Skip to content

Instantly share code, notes, and snippets.

@brunogaspar
brunogaspar / macro.md
Last active May 1, 2024 07:24
Recursive Laravel Collection Macros

What?

If a nested array is passed into a Laravel Collection, by default these will be threaded as normal arrays.

However, that's not always the ideal case and it would be nice if we could have nested collections in a cleaner way.

This is where this macro comes in handy.

Setup

@jhoff
jhoff / Enums.php
Last active November 18, 2023 20:47
Laravel Model Enumeration Trait
<?php
namespace App\Traits;
use Illuminate\Support\Str;
use App\Exceptions\InvalidEnumException;
trait Enums
{
/**
@bobbygrace
bobbygrace / trello-css-guide.md
Last active April 22, 2024 10:15
Trello CSS Guide

Hello, visitors! If you want an updated version of this styleguide in repo form with tons of real-life examples… check out Trellisheets! https://github.com/trello/trellisheets


Trello CSS Guide

“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”

You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?

@jonathantneal
jonathantneal / facebook.php
Last active December 8, 2020 12:07
Getting social media feeds as JSON in PHP
<?php
/* Getting a JSON Facebook Feed
==========================================================================
1. Sign in as a developer at https://developers.facebook.com/
2. Click "Create New App" at https://developers.facebook.com/apps
3. Under Apps Settings, find the App ID and App Secret
@kgn
kgn / jquery.flipbook.js
Created November 29, 2010 07:22
jQuery plugin to display an animated image sequence.
//By David Keegan
//InScopeApps.com
//http://inscopeapps.com/demos/flipbook/
(function($){
$.fn.flipbook = function(options){
options = $.extend({
'start': 0, //start frame
'end': 100, //end frame, must be greater then start
'step': 1, //number of frames to step over while animating