Skip to content

Instantly share code, notes, and snippets.

🍃
learning type

KaFai bruteforcecat

🍃
learning type
Block or report user

Report or block bruteforcecat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bruteforcecat
bruteforcecat / answer_for_quiz1_rail.md
Last active Aug 29, 2015
My answer for the quiz in the lesson 1 of Rails
View answer_for_quiz1_rail.md
  1. Why do they call it a relational database? Relational database are usually consisted of different tables which are related to other table by foreign key. And Foreign key in one table is the primary key of a record in another table. We can easily make a query base on different criteria on different table by joining the table.

2.What is SQL? SQL stands for Structured Query Language. It is a Domain Specific Language for managing data in RDBMS

  1. There are two predominant views into a relational database. What are they, and how are they different? They are the data and schema views. Data view displays like a spreadsheet. A schema view descripts the column names and the value type of each column.

  2. In a table, what do we call the column that serves as the main identifier for a row of data? We're looking for the general database term, not the column name.

View gist:638f14c1db44ab787a0d
Quiz: Lesson 3
1. What's the difference between rendering and redirecting? What's the impact with regards to instance variables, view templates?
They both complete a request but redirect will tell the client (browser) to send a brand-new request to a new URL. Therefore, no instance variable from previous action triggering the redirect will be available to the redirected view template . For rendering, the instance variable from the action will be avaiable for the view template being rendered.
2. If I need to display a message on the view template, and I'm redirecting, what's the easiest way to accomplish this?
flash[:notice]
3.If I need to display a message on the view template, and I'm rendering, what's the easiest way to accomplish this?
View gist:49de45e9737e7c3fad4c
<p>This is deprecated, in future versions you may need to <code>bundle binstub rails</code> to work around a system/bundle conflict.<br>
/home/kafai/.rvm/gems/ruby-2.0.0-p481/gems/paratrooper-0.0.1/lib/paratrooper.rb:1:in <code>require': cannot load such file -- heroku (LoadError)<br>
from /home/kafai/.rvm/gems/ruby-2.0.0-p481/gems/paratrooper-0.0.1/lib/paratrooper.rb:1:in</code>'<br>
from /home/kafai/.rvm/gems/ruby-2.0.0-p481@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in <code>require'<br>
from /home/kafai/.rvm/gems/ruby-2.0.0-p481@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in</code>block (2 levels) in require'<br>
from /home/kafai/.rvm/gems/ruby-2.0.0-p481@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in <code>each'<br>
from /home/kafai/.rvm/gems/ruby-2.0.0-p481@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in</code>block in require'<br>
from /home/kafai/.rvm/gems/ruby-2.0.0-p481@global/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in <code>each'<br>
View gist:823266d43a04a902b468
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d ' {"user":{"fullname":"Bob Chan","email":"bob@email.com","password":"password"}}' http://localhost:3000/api/users
View gist:aac9865ae19fa20666c7
CREATE TABLE shake_magnitudes (
event_id int,
user_id int,
recorded_at timestamp,
magnitude float,
PRIMARY KEY (event_id, user_id, recorded_at)
)
WITH CLUSTERING ORDER BY (user_id ASC, recorded_at ASC);
View gist:a4e467b90f585d1a0d5a
:e. :edit . at current working directory
:sp. :split . in split at current working directory
:vs. :vsplit . in vertical split at current working directory
:E :Explore at directory of current file
:Se :Sexplore in split at directory of current file
:Vex :Vexplore in vertical split at directory of current file
% create a new file
d create a new directory
R rename the file/directory under the cursor
@bruteforcecat
bruteforcecat / install.sh
Created May 16, 2016 — forked from chaos-ad/install.sh
Installing erlang in ubuntu
View install.sh
#!/bin/bash
# installing erlang on ubuntu's
VERSION="R15B01"
sudo apt-get install build-essential libncurses5-dev openssl libssl-dev
sudo mkdir -p /opt/erlang/
curl -O https://raw.github.com/spawngrid/kerl/master/kerl && chmod a+x kerl
sudo mv kerl /opt/erlang/
@bruteforcecat
bruteforcecat / upgrade-postgres-9.3-to-9.5.md
Created Jun 6, 2016 — forked from johanndt/upgrade-postgres-9.3-to-9.5.md
Upgrading PostgreSQL from 9.3 to 9.5 on Ubuntu
View upgrade-postgres-9.3-to-9.5.md

TL;DR

Install Postgres 9.5, and then:

sudo pg_dropcluster 9.5 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main
You can’t perform that action at this time.