git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
Copyright 2012 Shin Suzuki<[email protected]> | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software | |
distributed under the License is distributed on an "AS IS" BASIS, |
git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
-- `menu_click`, by Jacob Rus, September 2006 | |
-- | |
-- Accepts a list of form: `{"Finder", "View", "Arrange By", "Date"}` | |
-- Execute the specified menu item. In this case, assuming the Finder | |
-- is the active application, arranging the frontmost folder by date. | |
on menu_click(mList) | |
local appName, topMenu, r | |
-- Validate our input |
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
const Article = require('../../../../app/models/article');
Those suck for maintenance and they're ugly.
var gulp = require('gulp'), | |
watch = require('gulp-watch'), | |
// This will keeps pipes working after error event | |
plumber = require('gulp-plumber'), | |
// linting | |
jshint = require('gulp-jshint'), | |
stylish = require('jshint-stylish'), |
The easiest way to "convert" MKV to MP4, is to copy the existing video and audio streams and place them into a new container. This avoids any encoding task and hence no quality will be lost, it is also a fairly quick process and requires very little CPU power. The main factor is disk read/write speed.
With ffmpeg
this can be achieved with -c copy
. Older examples may use -vcodec copy -acodec copy
which does the same thing.
These examples assume ffmpeg
is in your PATH
. If not just substitute with the full path to your ffmpeg binary.
# An example struct. | |
defmodule Coin do | |
# Using Kernel.put_in/3 and other methods requires the target to have the Access behaviour. | |
@behaviour Access | |
# Structs by default do not implement this. It's easy to delegate this to the Map implementation however. | |
defdelegate get(coin, key, default), to: Map | |
defdelegate fetch(coin, key), to: Map | |
defdelegate get_and_update(coin, key, func), to: Map | |
defdelegate pop(coin, key), to: Map |
export enum Country { | |
Afghanistan = 'AF', | |
AlandIslands = 'AX', | |
Albania = 'AL', | |
Algeria = 'DZ', | |
AmericanSamoa = 'AS', | |
Andorra = 'AD', | |
Angola = 'AO', | |
Anguilla = 'AI', | |
Antarctica = 'AQ', |
I recently wanted to rename a model and its postgres table in a Phoenix app. Renaming the table was simple and documented, but the table also had constraints, sequences, and indexes that needed to be updated in order for the Ecto model to be able to rely on default naming conventions. I couldn't find any examples of what this would look like but was eventually able to figure it out. For anyone else in the same situation, hopefully this example helps.
In the example below, I'm renaming the Permission
model to Membership
. This model belongs to a User
and an Account
, so it has foreign key constraints that need to be renamed.
defmodule MyApp.Repo.Migrations.RenamePermissionsToMemberships do
use Ecto.Migration