Skip to content

Instantly share code, notes, and snippets.

@g0t4
g0t4 / Notes.md
Last active Apr 17, 2021
Getting Started with Docker on Windows
View Notes.md
View example-usage-component.js
import Ember from 'ember';
export default Ember.Component.extend({
theme: Ember.inject.service()
// ...
});
@adamwathan
adamwathan / v-cloak.md
Last active Mar 13, 2021
Useful CSS utilities for Vue.js cloaking
View v-cloak.md

Handy helpers for controlling visibility of elements until Vue has compiled.

Use like:

<div v-cloak>
  <h1>
    <span class="v-cloak--inline">Loading...</span> <!-- Only displayed before compiling -->
    <span class="v-cloak--hidden">{{ post.title }}</span> <!-- Hidden until compiling is finished -->
  </h1>
@christofluethi
christofluethi / gist:646ae60d797a46a706a5
Last active Apr 18, 2021
Convert m4a to mp3 on OS X command line using ffmpeg
View gist:646ae60d797a46a706a5
brew update
brew link yasm
brew link x264
brew link lame
brew link xvid
brew install ffmpeg
ffmpeg wiki:
https://trac.ffmpeg.org/wiki/Encode/MP3
@BerkeleyTrue
BerkeleyTrue / LoopbackSync.md
Last active May 23, 2018
Loopback Replication/Synchronization
View LoopbackSync.md

Loopback Sync

Sync in Loopback requires Loopback in the client as well the server.

Loopback attaches a replicate method to each Model Class. Lets say I define a model called 'RemoteMat' in my loopback server. In my client loopback app, I define a local varient of this model called 'LocalMat'.

My app would use Browserify to package Loopback for the client.

On first app load, I would call a Bi-direction replication (or syncronization) method. This is currently not implament in Loopback but it is easy to create. I will go into more detials later.

@johnbintz
johnbintz / simple-capistrano-docker-deploy.rb
Last active Aug 21, 2020
Simple Capistrano deploy for a Docker-managed app
View simple-capistrano-docker-deploy.rb
# be sure to comment out the require 'capistrano/deploy' line in your Capfile!
# config valid only for Capistrano 3.1
lock '3.2.1'
set :application, 'my-cool-application'
# the base docker repo reference
set :name, "johns-stuff/#{fetch(:application)}"
@tonymtz
tonymtz / gist:d75101d9bdf764c890ef
Last active Apr 8, 2021
Uninstall nodejs from OSX Yosemite
View gist:d75101d9bdf764c890ef
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
@givanse
givanse / after-render.js
Last active May 22, 2016
afterRenderEvent mixin
View after-render.js
import Ember from 'ember';
export default Ember.Mixin.create({
/*
This hook is guaranteed to be executed when the root element of this view has been inserted into the DOM.
*/
didInsertElement : function(){
this._super();
Ember.run.scheduleOnce('afterRender', this, this.afterRenderEvent);
@Andrew-Max
Andrew-Max / gist:305483febc3c367dbf57
Last active Jul 11, 2020
Route lifecycle hooks guide from Ember meetup lightning talk
View gist:305483febc3c367dbf57
App.LibraryRoute = App.ApplicationRoute.extend({
activate: function () {
//no longer enter
this._super();
only called once on entering a route.
},
beforeModel: function () {
// any state you want in place before the model is initialized, this is called before any model promises are resolved
// also could be used to conditionally prevent access to a route by throwing transition.abort
@Integralist
Integralist / Design Patterns: Adapter vs Facade vs Bridge.md
Last active Feb 12, 2021
Design Patterns: Adapter vs Facade vs Bridge
View Design Patterns: Adapter vs Facade vs Bridge.md

The three design patterns (Adapter, Facade and Bridge) all produce the result of a clean public API. The difference between the patterns are usually due to a subtle context shift (and in some cases, a behavioural requirement).

Adapter

The primary function of an Adapter is to produce a unified interface for a number of underlying and unrelated objects.

You will notice this pattern being utilised in many applications. For example, ActiveRecord (the popular Ruby ORM; object-relational mapping) creates a unified interface as part of its API but the code underneath the interface is able to communicate with many different types of databases. Allowing the consumer of the API to not have to worry about specific database implementation details.

The principle structure of this pattern is: