Skip to content

Instantly share code, notes, and snippets.

{
"db:create": "docker run --name todomvc-plusplus -v $(pwd)/pgdata:/var/lib/postgresql/data/pgdata -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword -e PGDATA=/var/lib/postgresql/data/pgdata -d postgres",
"db:start": "docker start todomvc-plusplus",
"db:stop": "docker stop todomvc-plusplus",
"db:remove": "npm run db:stop && docker rm todomvc-plusplus"
}

Get Info

ffmpeg -i input.avi

Remove the first 2 seconds from a video

ffmpeg -ss 2 -i input.flv -vcodec copy -acodec copy output.flv
@RyanHirsch
RyanHirsch / convert.bat
Last active August 28, 2016 15:38
Scripts for converting a video into `avi` for use in MediaShout
@echo off
rem the name of the script is drive path name of the Parameter %0
rem (= the batch file) but with the extension ".ps1"
set PSScript=%~dpn0.ps1
set args=%1
:More
shift
if '%1'=='' goto Done
set args=%args%, %1
goto More
@RyanHirsch
RyanHirsch / form.jsx
Created June 10, 2016 00:35
I have this amazingly complicated form. When I hit enter when in the input field, it always triggers the first button, not the submit (unless submit is first) why?
<form onSubmit={ evnt => {
evnt.preventDefault();
console.log({ pendingUser });
handleSave(person.merge(getValues(pendingUser)));
}} >
<div className="form-group">
<label htmlFor="firstname">First Name</label>
<input id="firstname" className="form-control" ref={ bindInput.bind(this, pendingUser, 'firstname') } defaultValue={ firstname } type="text" />
</div>
<div className="form-group">
import Ember from 'ember';
import hookableSort from 'demo-app/hookable-sort';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
foo: [ 'b', 'a', 'd', 'c' ],
sortedFoo: hookableSort('foo', function() {
// I don't know how to use method
console.log('things be happening');
})
@RyanHirsch
RyanHirsch / setElementHtml.js
Created December 14, 2015 13:32
Ember async test helper for use with content editable
export default Ember.Test.registerAsyncHelper('setElementHTML', function(app, selector, value) {
return new Ember.Test.promise(function(resolve) {
Ember.Test.adapter.asyncStart();
Ember.$(selector).html(value);
Ember.run.later(() => resolve(), 100);
Ember.Test.adapter.asyncEnd();
});
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
items: Ember.computed(function() {
return [
Ember.Object.create({ title: 'Foo', bucket: 'first' }),
Ember.Object.create({ title: 'Bar', bucket: 'first' }),
Ember.Object.create({ title: 'Baz', bucket: 'first' }),
Ember.Object.create({ title: 'Quxx', bucket: 'first' })
@RyanHirsch
RyanHirsch / not-working.hbs
Created July 2, 2015 13:33
{{#each}} key
{{#each ratings key="rater" as |rating|}}
<p>{{rating.rater}}</p>
<p>{{rating.rating}}</p>
<p>{{rating.confidence}}</p>
<hr/>
{{else}}
<p><em>No ratings for this employee</em></p>
{{/each}}
@RyanHirsch
RyanHirsch / adapter.js
Created April 6, 2015 11:42
Ember Spotify Adapters and Serializer
// app/album/adapter.js
import ApplicationAdapter from '../adapters/application';
export default ApplicationAdapter.extend({
host: 'http://api.spotify.com',
namespace: 'v1'
});
@RyanHirsch
RyanHirsch / README.md
Created January 15, 2015 17:09
note/edit action

I have a lock action defined on my notes route. When I navigate directly to note/edit and the this.send('lock', model); throws an error because nothing handled it, but when I go to note and click the edit button the action goes to the notes route and it all works as I expect. Why is the action handled differently on a direct navigation to note/edit compared to note then clicking edit?