Skip to content

Instantly share code, notes, and snippets.

View yoyozi's full-sized avatar
😄
Coding

Craig Leppan yoyozi

😄
Coding
View GitHub Profile
On macOS High Sierra (and perhaps earlier), cron is disabled in some configurations. There is, however, still a LaunchDaemon for it.
Check to see if cron is enabled:
sudo launchctl list | grep cron
You should see com.vix.cron.plist if cron is running. If cron is not running, you should do:
sudo launchctl load -w /System/Library/LaunchDaemons/com.vix.cron.plist
That will start cron, and the -w switch will make sure it starts after reboots as well.
@yoyozi
yoyozi / Development env Rails
Last active February 15, 2018 13:27
Setup dev env on Mac Sierra
Open terminal
> ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Say yes to X-Code (have fast connection for download)
> brew install rbenv ruby-build
Add rbenv to bash so that it loads every time you open a terminal
> echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
> source ~/.bash_profile
Install Ruby
@yoyozi
yoyozi / Rails charts
Created May 2, 2017 01:11
Highcharts and Chartcick
Asynchronous charts
Create a Postgres user for the Rails app, switch into the Postgres user:
> sudo su postgres
Then login to the databse "postgres" with the adn\min of "postgres"
> psql -d postgres -U postgres
or > sudo -u postres psql
Then create a user (or a "role", as Postgres calls it):
create role myapp with createdb login password 'password1';
> ALTER user myapp with superuser;
> psql postgres
@yoyozi
yoyozi / Sublime
Last active March 20, 2017 11:49
Sublime in Vintage mode: I am now rocking
Join 3 lines: v for visual mode select then: cmd J
Select every instance of the word you are on: cmd ^ G (Man OH Man)
Select the word: cmd D
Multiple cursors: to edit with multiple cursors go to first letter of word and enter: cmd D, next cmd D again to enter 2nd occurance and hence 2nd cursor
Visual select: Shif up/down/lft/rgt Go to beginning of line: cntrl cmd L cntrl left
Column view: hold down alt up/down/lft/rgt or mouse
Select the entire line: Shift cmd lft
Move through tabs: cntrl cmd left rght
Innitialize Git
$ git config --global user.name "Your Name"
$ git config --global user.email your.email@example.com
$ git init
$ git add -A
The added files are initially placed in a staging area, which contains pending
gem install rails -v 5.0.0
Adding referance to migration
rails g migration AddUserToUploads user:references
rails g scaffold Tool name:string description:text
rails g migration AddToolToUsdzar tool:references
brew install postgresql
If this is your first time installing Postgres with Homebrew, you'll need to
create a database with:
$ initdb /usr/local/var/postgres -E utf8
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.5.3/homebrew.mxcl.postgresql.plist
~/Library/LaunchAgents/
lunchy start postgres
lunchy stop postgres
ctrl - c create
ctl-p previous n next w list
tmux new -s name to create a new session to re-attach to in future
ctrl-b d detach from session
tmux list-sessions lists the sessions
tmux attach name attaches to the session
ctrl-b o moves to pane
ctrl-b " opens horizontally
ctrl-b % opens virtically