Skip to content

Instantly share code, notes, and snippets.


Ryan Rampersad ryanmr

View GitHub Profile
View evan-you-effect.js
document.addEventListener('touchmove', function (e) {
var c = document.getElementsByTagName('canvas')[0],
x = c.getContext('2d'),
pr = window.devicePixelRatio || 1,
w = window.innerWidth,
h = window.innerHeight,
f = 90,
View FeedsController.php
namespace App\Http\Controllers\Frontend;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use \Carbon\Carbon;
View query.txt
array:2 [▼
0 => array:3 [▼
"query" => "select * from `episodes` where (`hidden` = ? and `unlisted` = ? and `state` = ? and exists (select * from `series` where `episodes`.`series_id` = `series`.`id` and `slug` = ?) or exists (select * from `episodes_relations` as `self_a536d4a0691c58055cceecc94fd32e35` where `self_a536d4a0691c58055cceecc94fd32e35`.`episode_id` = `episodes`.`id` and `type` = ? and exists (select * from `series` where `episodes`.`series_id` = `series`.`id` and `slug` = ?) and `episodes`.`deleted_at` is null)) and `episodes`.`deleted_at` is null order by `published_at` desc, `created_at` desc"
"bindings" => array:6 [▼
0 => false
1 => false
2 => "published"
3 => "pk"
4 => "parent"
5 => "pk"
View episode-series-special.php
episodes (id, series_id, ...etc)
episode_relations (id, episode_id, episode_related_id)
series (id, slug, ...etc)
Some episodes are related to each other by the episodes_relations pivot table.
get all of the episodes of the `specified-slug` series, and all of the episodes of `special-slug` that have a related parent episode that is in the `specified-slug` series
View episode_feed.php
$episodes = App\Episode::with(['related'])
whereHas('related', function($query){
$query->where('type', '=', 'parent')
->whereHas('related.series', function($query){
$query->where('slug', '=', 'pk');

A short story about a six month bug

I've been tinkering with Laravel for at least six months ago with a realistic goal of finishing a custom Nexus CMS before I expire of old age. A few months ago, I came around to adding the functionality for Episode events, specifically, applying default hosts and album art to an episode of none were specified when it was initally created -- short of a shortcut feature.

I will be addressing some classes (an Event, and a Listener, and below, a tiny fraction of the Episode model) from this gist published earlier. There might be some minor changes between this and production code, but it suffices.

    public function store(Request $request)
View ApplyEpisodeDefaults.php
namespace App\Listeners;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
// use Log;
use App\Episode;


Here's a short linear unreasoned response to @brandon_mn's link: Uber Welfare Sharing Gig Economy.

  • It's great that there is a variety of worldly tasks people can pick up, especially with in the flexibly hours frame, plus the varying degrees of skill you can gradually climb the rungs.
  • The Internet is a great equalizer; before I force "restore work requirements for food stamps", I'd force easy access to cheap and/or inexpensive fiber Internet first. There's no point integerating all of this Internet based working when we can barely get decent speeds, rates and caps.
  • Maybe there's an example I have not seen yet; my grandmother relies on foodstamps, and I just doubt she can handle a gig economy requirement to get those foodstamps. Sure, exceptions and such. That's what they all say at first. I tried to get my grandmother (who stays at home 90% of the time, and has had
View what.js
// size, length, type, mime, url, id
var media_allowed = ['size', 'length', 'type', 'mime', 'url', 'id']; = => {
var m = {id:, length: o.length, type: o.type, mime: o.mime, url: o.url};
return m;
// what was I thinking when I wrote this three months ago?
View error.log
ryan@server2:~/nexus/cli$ python upload ../live/ted8.mp3 ../live/tf361.mp3
|=== Upload ===|
Connecting to Amazon S3 (the-nexus-tv)
Traceback (most recent call last):
File "", line 216, in <module>
File "", line 214, in main
File "", line 68, in main_upload
You can’t perform that action at this time.