This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using pure SQL | |
SELECT name FROM students WHERE name LIKE 'input_text%' | |
# Or you can use activerecored query | |
Student.select(:name).where("name LIKE '#{params[:input_text]}%'") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get update | |
sudo apt-get install curl nodejs | |
# Para instalar o rvm | |
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 | |
\curl -sSL https://get.rvm.io | bash -s stable | |
# Escrever isso no arquivo ~/.bashrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\begin{tabular}{l p{10cm}} | |
API & Application Programming Interface \\ | |
DOM & Document Object Model \\ | |
DRY & Don't Repeat Yourself \\ | |
HTML & Hypertext Markup Language \\ | |
IHC & Interação Humano Computador \\ | |
JSON & Javascript Object Notation \\ | |
ORM & Object Relational Mapper \\ | |
QR Code & Quick Response Code \\ | |
SPA & Single Page Application \\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi, I'm writing a follow api | |
https://github.com/viniciusalonso/droid_doctor_api | |
I'm trying doing a POST to '/api/v1/patients' with a json below: | |
"{patient: {\"name\":\"Test\",\"age\":\"24\",\"sex\":\"m\",\"phone\":\"99000099\"}}" . | |
The api returned an error 400 bad request. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -i -X POST -H "Content-Type: application/json" -d "{'doctor': {'name':'xablau', 'crm': '123478', 'specialty': 'Pediatra'} }" http://localhost:3000/api/v1/doctors | |
curl -i -X POST POST -H "Content-Type: application/json" -d "{'doctor': {'name':'xablau', 'crm': '123478', 'specialty': 'Pediatra'} }" | |
curl -i -X POST -H "Content-Type: application/json" -d "{'doctor': {'name':'xablau', 'crm': '123478', 'specialty': 'Pediatra'} }" http://localhost:3000/api/v1/doctors | |
curl -i -X POST -H "Content-Type: application/json" -d "'doctor': {'name': 'xablau', 'crm': '123478', 'specialty': 'Pediatra'} }" http://localhost:3000/api/v1/doctors | |
curl -i -X POST -H "Content-Type: application/json" -d '"doctor": {"name": "xablau", "crm": "123478", "specialty": "Pediatra"} }' http://localhost:3000/api/v1/doctors | |
curl -i -X POST -H "Content-Type: application/json" -d ' 'doctor: {"name": "xablau", "crm": "123478", "specialty": "Pediatra"} }' http://localhost:3000/api/v1/doctors | |
curl -X POST -H "Content-Type: application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#tag-pai-dos-botoes').on('click', '.remove_emprego',function(){ | |
alert('teste'); | |
$('.'+$(this).attr('value')).remove(); | |
n = parseInt($('#contador_emprego').val())-1; | |
$('#contador_emprego').val(n); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Método do controller | |
def update_state | |
@order = Order.includes(:table).find(params[:id]) | |
@order.update({state: params[:state]}) | |
if @order.ready? or @order.being_prepared? | |
# Faz uma publicação no canal waiter | |
# Dentro do canal tem uma "subseção" chamada update_waiter_screen | |
WebsocketRails[:waiter].trigger(:update_waiter_screen, @order.to_json(include: :table)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Product { | |
private $value; | |
private $name; | |
public function __construct($name, $value) { | |
$this->name = $name; | |
$this->value = $value; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Item { | |
private $product; | |
private $quantity; | |
public function __construct($product, $quantity) { | |
$this->product = $product; | |
$this->quantity = $quantity; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Cart { | |
private $owner; | |
private $items; | |
public function __construct($owner, $items) { | |
$this->owner = $owner; | |
$this->items = $items; | |
} | |
OlderNewer