Skip to content

Instantly share code, notes, and snippets.

View defenestrator's full-sized avatar

Jeremy Jacob Anderson defenestrator

  • I'm great company.
  • Boise, ID
  • 20:23 (UTC -06:00)
View GitHub Profile
@defenestrator
defenestrator / awesome_favorite_fizzbuzz.js
Last active May 17, 2022 04:45
Some Fizzbuzz for meditation
// This one is interesting because no previously checked condition is re-checked
// It is a self-executing function that contains a declarative function named fizzbuzz() and a for loop
// Too much fun
(function() {
function fizzbuzz(i) {
const test = (d, s, x) => i % d == 0 ? _ => s + x('') : x
const fizz = x => test(3, 'Fizz', x)
const buzz = x => test(5, 'Buzz', x)
console.log(fizz(buzz(x=>x))(i.toString()))
}
<?php
/*
* This file is part of the League\Fractal package.
*
* (c) Phil Sturgeon <me@philsturgeon.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Serializer;
<?php
/*
//Normal query
User::all();
//Cached query (default 60min)
User::cached()->all();
//Cached query (5min)

@kangax's ES6 quiz, explained

@kangax created a new interesting quiz, this time devoted to ES6 (aka ES2015). I found this quiz very interesting and quite hard (made myself 3 mistakes on first pass).

Here we go with the explanations:

Question 1:
(function(x, f = () =&gt; x) {
@amochohan
amochohan / 01_Laravel 5 Simple ACL manager_Readme.md
Last active November 8, 2023 21:03
Laravel 5 Simple ACL - Protect routes by an account / role type

#Laravel 5 Simple ACL manager

Protect your routes with user roles. Simply add a 'role_id' to the User model, install the roles table and seed if you need some example roles to get going.

If the user has a 'Root' role, then they can perform any actions.

Installation

Simply copy the files across into the appropriate directories, and register the middleware in App\Http\Kernel.php

@andrewdelprete
andrewdelprete / laracon-2014-notes.md
Last active November 19, 2018 17:19
My notes from Laracon 2014

###Jeffrey Way (1) - Bootcamp

Jeffrey went through about 12 subjects one right after the other and gave tips along the way.

  1. Mail Drivers for mail notifications.
1. With Laravel 4.2 it’s easier to use APIs like Mailgun and Mandrill for e-mail notifications. This avoids using SMTP which is really cool.
  1. File Generators for generating schema migrations.
@Fedalto
Fedalto / pre-receive
Created March 27, 2013 20:25
Git hook to make a git repository master branch read only. This should go in .git/hooks/
#!/usr/bin/env ruby
old_sha1, new_sha1, ref = gets.split
if ref == "refs/heads/master":
puts "Pushing to origin/master is not permitted."
puts "This is a read-only branch."
puts ""
puts "Create a new branch instead, or commit to SVN."