- rebasing tip
- move commit up a line
Change language
ctrl
+shift
+L
-
Problem output
\uFEFFvendor_id
-
Use
xxd
to confirm -
Check that you have
xxd
which xxd
-
Run xxd
head -n 4 ~/downloads/newmappings.csv| xxd
-
Example output (note the three dots)
00000000: efbb bf76 656e 646f 725f 6964 2c6e 616d ...vendor_id,nam
-
One solution
pbcopy < path/to/newmappings.csv
&pbpaste > path/to/newmappings.csv
-
Another solution
tail -c +4 < path/to/newmappings.csv
When this error comes up:
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> nw/CVS-119/MetroNorth
Run this: git pull origin nw/CVS-119/MetroNorth
$ git add ... # Stage a fix
$ git commit --fixup=a0b1c2d3 # Perform the commit to fix broken a0b1c2d3
$ git rebase -i --autosquash a0b1c2d3~1 # Now merge fixup commit into broken commit
$ git add ... # Stage a fix
$ git commit --fixup 8ebb3bd # Use the SHA from commit to be added to
$ git rebase -i master # Stage a fix
Once in the interactive console, the new commits should be under the commit to be added to. Change the new commit from pick
to fixup
- Repo: Beekman
- Problem: When using
acts_as_list
on offer model, and scoping withpublished_at
previously working tests starting failing - Solution: Add
add_new_at: nil
, so the entireacts_as_list
markup looks like this:acts_as_list scope: [:published_at], add_new_at: nil
- Explanation: When testing,
acts_as_list
was including a position with each item created for the testing, this would then trigger other components of theoffer.rb
model. It would also give any new item created in the CMS a position, which didnt necessarily break anything, but is not proper behavior.
JavaScript utility library https://lodash.com/
-
Building custom rake tasks
-
files live in
lib/tasks
-
This is a rake task to update each
Club
with its timezonenamespace :time_zone do desc 'Populate club time_zones' task populate_time_zones: :environment do puts ' - updating club time_zones' Club.find(1).update_attribute(:time_zone, "Central Time (US & Canada)") Club.find(2).update_attribute(:time_zone, "Eastern Time (US & Canada)") Club.find(3).update_attribute(:time_zone, "Eastern Time (US & Canada)") Club.find(4).update_attribute(:time_zone, "Eastern Time (US & Canada)") ... Club.find(185).update_attribute(:time_zone, "Mountain Time (US & Canada)") puts ' - club time_zones update complete' end end
- namespace -> Used to group multiple, similar rake tasks (not applicable in this example, not actually needed for this one)
- desc -> Description so one doesnt have to read the code, also displays when using
rake -T
to see all available tasks - task -> Name of the task
- :environment -> Loads the environment, to have access to
Club
- call with
rake time_zone:populate_time_zones
-
A more automated rake task:
namespace :users do desc 'Recalculates Badges for All Users' task recalculate_badges: :environment do User.find_each do |user| puts "#{user.first_name} #{user.last_name} - #{user.email}" RecalculateBadges.new(user).all end end end
- Utilizing an
each
function for a more automated script
- Utilizing an
-
Resources:
- confirm db and user by using the
psql
interfacepsql
\l
<- lists out all the databases and associated users
psql -U noelworden crunch_class_development < /Users/noelworden/crunch_class_development.pgsql
psql -U noelworden
<- usercrunch_class_development
<- DB to be imported into/Users/noelworden/crunch_class_development.pgsql
<- location of the DB dump
-
if this error occurs
PG::ObjectInUse: ERROR: database "crunch_class_development" is being accessed by other users
-
run this command, with the appropriate db after
grep
ps ax | grep crunch
-
should get something like this:
6186 ?? S 0:00.78 spring server | crunch-class | started 93 hours ago 6187 ?? Ss 6:55.65 spring app | crunch-class | started 93 hours ago | development mode 97841 ?? Ss 0:00.15 postgres: root crunch_class_development ::1(61095) idle
-
pick an ID (first column) and run:
kill 6168
-
middleman freeze
lsof -i tcp:4567
kill -9 "PID"
- reset branch to master
git reset --hard origin/master
- commit as normal, message does not matter
git rebase -i master
- pick
fixup
for whatever commit should be added to the branch
localStorage.clear()
- (in the dev tools console)
position: absolute;
z-index: 1;