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
| class Api::RegistrationsController < Api::BaseController | |
| respond_to :json | |
| def create | |
| user = User.new(params[:user]) | |
| if user.save | |
| render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
| return | |
| else |
| #!/bin/bash | |
| # current Git branch | |
| branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,') | |
| # v1.0.0, v1.5.2, etc. | |
| versionLabel=v$1 | |
| # establish branch and tag name variables | |
| devBranch=develop |
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
| // Takes a URL, param name, and data string | |
| // Sends to the server.. The server can respond with binary data to download | |
| jQuery.download = function(url, key, data){ | |
| // Build a form | |
| var form = $('<form></form>').attr('action', url).attr('method', 'post'); | |
| // Add the one key/value | |
| form.append($("<input></input>").attr('type', 'hidden').attr('name', key).attr('value', data)); | |
| //send request | |
| form.appendTo('body').submit().remove(); |
| // Returns an array of dates between the two dates | |
| function getDates (startDate, endDate) { | |
| const dates = [] | |
| let currentDate = startDate | |
| const addDays = function (days) { | |
| const date = new Date(this.valueOf()) | |
| date.setDate(date.getDate() + days) | |
| return date | |
| } | |
| while (currentDate <= endDate) { |
| # Call scopes directly from your URL params: | |
| # | |
| # @products = Product.filter(params.slice(:status, :location, :starts_with)) | |
| module Filterable | |
| extend ActiveSupport::Concern | |
| module ClassMethods | |
| # Call the class methods with names based on the keys in <tt>filtering_params</tt> | |
| # with their associated values. For example, "{ status: 'delayed' }" would call |
| HTTP status code symbols for Rails | |
| Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings. | |
| Status Code Symbol | |
| 1xx Informational | |
| 100 :continue | |
| 101 :switching_protocols | |
| 102 :processing |
| #!/bin/sh | |
| # Borrowed from http://marcparadise.com/blog/2013/09/21/how-to-fix-a-corrupt-history-file/ | |
| # If you ever see a message like this upon starting a new shell | |
| # zsh: corrupt history file /home/marc/.zsh_history | |
| # here is a quick fix | |
| cd ~ | |
| mv .zsh_history .zsh_history_bad | |
| strings .zsh_history_bad > .zsh_history | |
| # And reload history | |
| fc -R .zsh_history |