Skip to content

Instantly share code, notes, and snippets.

@JacobBennett
JacobBennett / blog.md
Last active August 23, 2018 11:06
How Laravel's SerializesModels Trait Could Save Your Bacon

When a Laravel Job is dispatched that takes an Eloquent Model as an argument in the constructor, you can use the SerializesModels trait which will only serialize the model identifier. When the job is actually handled, the queue system will automatically re-retrieve the full model instance from the database (docs). Taylor also announced that in Laravel 5.3, you will also be able to do this with Eloquent Collections! (link)

5.3 Collections Serialization

So why is it necessary or helpful for the framework to re-retrieve the model values from the DB at run time instead of just serializing the attributes of the given model or collection? Let's use a contrived example to demonstrate.

Let's say that you create a new job called SendWelcomeEmail that will be dispatched from your RegistrationController each time a new user signs up for

@kenichi-shibata
kenichi-shibata / counter-test.html
Created November 26, 2015 04:42
using deep freeze to test if the states are mutating
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Avoiding mutations</title>
<script src="https://wzrd.in/standalone/expect@latest"></script>
<script src="https://wzrd.in/standalone/deep-freeze@latest"></script>
</head>
<body>
@debashisbarman
debashisbarman / README.md
Last active February 15, 2024 02:19
A boilerplate Twitter bot that can retweet in response to the tweets matching particluar keyword (https://goo.gl/4whEIt)

Creating a Twitter bot with Node.js

Learn how you can create your own Twitter bot using Node.js and the new Twitter API. The bot will auto retweet in response to tweets with some particular hashtags. (https://goo.gl/4whEIt)

Tools we need

Here are the tools we’ll be using to create the bot — 

  • Node.js installed in your machine
  • A registered Twitter account

Create a Twitter application

@pisculichi
pisculichi / radios_nacionales.txt
Last active May 2, 2026 21:24
URLs de radios nacionales de Argentina, para poder escuchar en la terminal con mplayer o vlc
# alias radio='function __radio(){ r=`grep -v "#" radios_nacionales.txt | grep -m 1 -i $1 | cut -d" " -f1`; cvlc $r 2> /dev/null; }; __radio'
# podria utilizarse mplayer en vez de vlc
AMs Nacionales
http://cdn.instream.audio:9288/stream Radio Madre 530
https://streaming1.hostingmontevideo.com:7019/; Radio Colonia 550
http://server.laradio.online:25224/live.mp3 Radio Argentina 570
http://playerservices.streamtheworld.com/api/livestream-redirect/CONTINENTAL_SC Continental 590
https://streammax.alsolnet.com/radiorivadavia Rivadavia 630
@kennwhite
kennwhite / vpn_psk_bingo.md
Last active April 20, 2026 05:58
Most VPN Services are Terrible

Most VPN Services are Terrible

Short version: I strongly do not recommend using any of these providers. You are, of course, free to use whatever you like. My TL;DR advice: Roll your own and use Algo or Streisand. For messaging & voice, use Signal. For increased anonymity, use Tor for desktop (though recognize that doing so may actually put you at greater risk), and Onion Browser for mobile.

This mini-rant came on the heels of an interesting twitter discussion: https://twitter.com/kennwhite/status/591074055018582016

@staltz
staltz / introrx.md
Last active May 7, 2026 01:31
The introduction to Reactive Programming you've been missing
@planetoftheweb
planetoftheweb / tweets_json.php
Created July 2, 2013 23:33
This gist will let you retrieve a series of tweets using the twitter v1.1 API. There's a few steps you have to do before you use this. 1. First, you need to go to http://dev.twitter.com/apps and create a new application. 2. You'll also need to download this library. https://github.com/themattharris/tmhOAuth (You only need the tmhOAuth.php file) …
<?php
require 'tmhOAuth.php'; // Get it from: https://github.com/themattharris/tmhOAuth
// Use the data from http://dev.twitter.com/apps to fill out this info
// notice the slight name difference in the last two items)
$connection = new tmhOAuth(array(
'consumer_key' => '',
'consumer_secret' => '',
'user_token' => '', //access token
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active April 24, 2026 19:00
A badass list of frontend development resources I collected over time.