Skip to content

Instantly share code, notes, and snippets.

View weotch's full-sized avatar
👋
Heya

Robert Reinhard weotch

👋
Heya
View GitHub Profile
@weotch
weotch / gist.php
Last active February 23, 2016 19:18 — forked from anonymous/gist.php
<?php
Route::get('guidelines/{slug}/{page}', ['as' => 'guideline-page', function($slug, $page) {
$guideline = Guideline::findBySlugOrFail($slug);
$page = $guideline->guidelineBlocks()->where('slug', $page)->firstOrFail();
// previous pages
$previous = $guideline->guidelineBlocks()
->where('guideline_blocks.position', '<', $page->position)
->orderBy('guideline_blocks.position', 'desc')
@weotch
weotch / vue-video.md
Created February 3, 2016 22:35
Notes on using <video> with Vue.js
  • When you are ready to play a video, insert the markup into the DOM with autoplay=auto preload on the tag. Don’t add the markup early and load() or play() it later. If you have the markup in there when the Vue component compiles, it will trigger multiple video loads
  • When listening when to show the video (like fade it in), listen for the timeupdate event, not canplaythrough. This ensures that the video will already be playing when you show it. In Safari, the canplaythrough plays too soon and will pause on the first frame for a bit (edited)
  • When you animate the video in, never have it display:none or in Safari it will pause on the first frame. Set the opacity to 0 and then fade it in when ready, for instance
  • Make sure webm is before mp4, it helps FF out a lot
@weotch
weotch / .bash_profile
Created January 13, 2016 18:04
npm aliases
# Run an npm script
alias run="npm run"
# Create a deduped and prined shrinkwrap file
alias shrink="npm dedupe && npm prune && npm shrinkwrap"
# Update npm deps and shrinkwrap
alias npmup="npm update && shrink"
var root = this;
(function( jQuery ) {
if ( root.XDomainRequest ) {
jQuery.ajaxTransport(function( s ) {
if ( s.crossDomain && s.async ) {
if ( s.timeout ) {
s.xdrTimeout = s.timeout;
delete s.timeout;
}
@weotch
weotch / styles.less
Last active May 24, 2017 20:38
My hacks to atom material theme
/*
* Your Stylesheet
*
* This stylesheet is loaded when Atom starts up and is reloaded automatically
* when it is changed and saved.
*
* Add your own CSS or Less to fully customize Atom.
* If you are unfamiliar with Less, you can read more about it here:
* http://lesscss.org
*/
@weotch
weotch / l5-packages.md
Last active August 29, 2015 14:27
Laravel 5 package development
  1. Install studio globally.
  2. Tweak the generated autoload stuff in vendor/autoload.php to put higher-level consumers at the start:
// @generated by Composer Studio (https://github.com/franzliedke/studio)

require_once __DIR__ . '/../workbench/decoy/vendor/autoload.php';
require_once __DIR__ . '/../workbench/upchuck/vendor/autoload.php';
require_once __DIR__ . '/../workbench/cloner/vendor/autoload.php';
require_once __DIR__ . '/../workbench/library/vendor/autoload.php';
@weotch
weotch / shopify.md
Last active June 3, 2016 22:29
Managing Shopify content

Here is a summary of different options that Shopify offers for managing content inclduing managing externally.

The config/settings_schema.json file lives in your theme and lets you define fields that are editable in the Storefront editor. These values can be used in css and js as well as the liquid files.

You can create a number of different field types:

@weotch
weotch / blah.md
Last active September 18, 2017 22:02
Slack "material" theme
#263238,#295154,#294547,#80CBC4,#326063,#AEBDC4,#80CBC4,#80CBC4

<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ProductImagesTable extends Migration {
/**
* Run the migrations.
*
@weotch
weotch / notes.md
Last active August 29, 2015 14:16
Hardened JS queries
  • Another module, a mediator, would call query({types:"one,two"}) to intiate a search.
  • The query() method is debounced to prevent a bunch of successive calls if the person is actively using the UI. But, it has the leading and trailing attributes so that the first clicks is immediately handled and so that a final GET is made once the user is done being spastic, responding to the final search terms.
  • We save the xhr response so that we can use it to abort a still running request. Thus, if the request still hasn't finished by the time the trailing execution happens, the done() callback won't be fired for the previous query.