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 / 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

Keybase proof

I hereby claim:

  • I am weotch on github.
  • I am weotch (https://keybase.io/weotch) on keybase.
  • I have a public key ASBCgb1U160YrEag6TP5xlzUDbEKOP4x29GeJ8qPiZumZwo

To claim this, I am signing this object:

@weotch
weotch / Laravel 4: Service Providers and Facades.md
Last active December 15, 2019 01:55
Laravel 4: Service Providers and Facades

Lets look at how Facades work in Laravel 4 by investigating the flow of one of the facaded classes: URL. As in <?=URL::route('news')?>.

The logic flow

As you'll see in the summary, this isn't exactly described in the procedural order your app is executed. But I think it serves to explain what's going on.

  1. The app config has an aliases array. In there is: 'URL' => 'Illuminate\Support\Facades\URL'. If you look up that class, you'll see it just has this: protected static function getFacadeAccessor() { return 'url'; } and that it inherits from Illuminate\Support\Facades\Facade. We'll get back to this later.

  2. Lets now turn to how the app boots up. The /vendor/laravel/framework/src/Illuminate/Foundation/start.php bootstrap file calls registerAliasLoader() on an instance of Illuminate\Foundation\Application.

@weotch
weotch / webpack.config.coffee
Created June 13, 2018 16:45
Example Decoy custom js/css webpack build config
###
Generate customized Decoy assets
###
# Deps
ExtractText = require 'extract-text-webpack-plugin'
autoprefixer = require 'autoprefixer'
webpack = require 'webpack'
# Autoprefixer config
@weotch
weotch / blah.md
Last active September 18, 2017 22:02
Slack "material" theme
#263238,#295154,#294547,#80CBC4,#326063,#AEBDC4,#80CBC4,#80CBC4

@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 / gist:1959748
Created March 2, 2012 17:16
Running PHP scripts from CLI on Heroku
# Add this config
$ heroku config:add LD_LIBRARY_PATH=/app/php/ext:/app/apache/lib
# Login to Heroku CLI
$ heroku run bash
# The second argument here is the path to your script
~ $ ~/php/bin/php -f ~/www/index.php
@weotch
weotch / install.sh
Created December 6, 2016 20:34
Import es6 modules to coffeescript and vue-loader
yarn add babel-loader babel-core babel-preset-es2015 --dev
@weotch
weotch / gist:04709761d4accd60b894591a336e784d
Last active November 21, 2016 23:21 — forked from samnang/gist:1759336
Install Bash version 4 on MacOS X
# Install Bash 4 using homebrew
brew install bash
# Add the new shell to the list of legit shells
sudo bash -c "echo /usr/local/bin/bash >> /private/etc/shells"
# Change the shell for the user
chsh -s /usr/local/bin/bash
# Restart terminal.app (new window works too)
@weotch
weotch / info.md
Last active September 5, 2016 09:01
Adding Memcache and Redis to MAMP 2.1.3 (PHP 5.3.20)

Adding Memcache and Redis to MAMP 2.1.3 (PHP 5.3.20)

Not sure how long this will be good for, but here's an easy path to adding Memached and Redis support to MAMP 2.1.3. It depends on the fact that, right now, the Homebrew PHP project and MAMP are using the same versions of PHP. This assumes you have Homebrew and MAMP 2.1.3 installed. I'll just be describing the process for PHP 5.3.20.

  1. Make sure you've tapped homebrew-dupes and homebrew-php with: brew tap homebrew/dupes and brew tap josegonzalez/php.

  2. Install memcached and redis for PHP Homebrew: brew install php53-memcache and brew install php53-redis.

  3. Go into MAMP and navigate to: File menu > Edit Template > PHP > PHP 5.3.2.0 php.ini.