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
{ | |
"recent-launches": { | |
"recent-launch1": { | |
"course_id": 312, | |
"title": "Terence Tao Teaches Mathematical Thinking", | |
"slug": "terence-tao-teaches-mathematical-thinking", | |
"universal_link": "https://www.masterclass.com/classes/312", | |
"vanity_name": "TT", | |
"instructor_name": "Terence Tao", | |
"teaches": "Mathematical Thinking", |
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
{"data":{"courses":{"terence-tao-teaches-mathematical-thinking":{"course_id":312,"title":"Terence Tao Teaches Mathematical Thinking","slug":"terence-tao-teaches-mathematical-thinking","universal_link":"https://www.masterclass.com/classes/312","vanity_name":"TT","instructor_name":"Terence Tao","teaches":"Mathematical Thinking","class_persona":null,"overview_text":"World-renowned mathematician Dr. Terence Tao teaches you his approach to everyday problem-solving—without complex equations or formulas.","course_header_image":"https://www.masterclass.com/course-images/attachments/ejmrzq89p4zpxdgih9327bk7cn1r","course_headshot":"https://www.masterclass.com/course-images/attachments/vyo6j7ix3zs1bcpegd1aest38fp9","5x12_image":"https://www.masterclass.com/course-images/attachments/3udqajqs3z7vvqiqbm54eprttjda","skill_1":"Math Fails","skill_1_img":"https://www.masterclass.com/course-images/attachments/mnyqbotlwy7erc123ksn2b86rynm","skill_2":"Stumped","skill_2_img":"https://www.masterclass.com/course-images/attachments/o |
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
#!/bin/bash | |
# | |
# Automatically find and run specs corresponding to changed files or | |
# terms passed in. | |
# | |
CMD="bin/rspec" | |
function usage { | |
echo "Usage: $0 [match terms]" |
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
const mqtt = require('mqtt') | |
let client | |
const DEVICE_ID = '12345-abcd-el-propio' | |
/** | |
* Simulating the device's setup function/ | |
*/ | |
function setup() { | |
client = mqtt.connect('mqtt://test.mosquitto.org') | |
} |
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
Post Load (0.4ms) SELECT "posts".* FROM "posts" | |
Comment Load (0.4ms) SELECT "comments".* FROM "comments" WHERE "comments"."post_id" IN ($1, $2, $3, $4, $5) ORDER BY "comments"."likes" DESC [["post_id", 1], ["post_id", 2], ["post_id", 3], ["post_id", 4], ["post_id", 5]] |
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
class Post < ApplicationRecord | |
has_many :comments | |
has_many :uncensored_comments, -> { where(censored: false) }, class_name: 'Comment' | |
# rails will automatically limit the number of records for us | |
has_one :most_liked_comment, -> { order(likes: :desc) }, class_name: 'Comment' | |
end |
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
Post Load (0.4ms) SELECT "posts".* FROM "posts" | |
Comment Load (0.9ms) SELECT "comments".* FROM "comments" WHERE "comments"."post_id" = $1 ORDER BY "comments"."likes" DESC LIMIT $2 [["post_id", 1], ["LIMIT", 1]] | |
Comment Load (0.7ms) SELECT "comments".* FROM "comments" WHERE "comments"."post_id" = $1 ORDER BY "comments"."likes" DESC LIMIT $2 [["post_id", 2], ["LIMIT", 1]] | |
Comment Load (0.6ms) SELECT "comments".* FROM "comments" WHERE "comments"."post_id" = $1 ORDER BY "comments"."likes" DESC LIMIT $2 [["post_id", 3], ["LIMIT", 1]] | |
Comment Load (0.3ms) SELECT "comments".* FROM "comments" WHERE "comments"."post_id" = $1 ORDER BY "comments"."likes" DESC LIMIT $2 [["post_id", 4], ["LIMIT", 1]] | |
Comment Load (0.4ms) SELECT "comments".* FROM "comments" WHERE "comments"."post_id" = $1 ORDER BY "comments"."likes" DESC LIMIT $2 [["post_id", 5], ["LIMIT", 1]] |
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
Post Load (0.5ms) SELECT "posts".* FROM "posts" | |
Comment Load (0.9ms) SELECT "comments".* FROM "comments" WHERE "comments"."censored" = $1 AND "comments"."post_id" IN ($2, $3, $4, $5, $6) [["censored", false], ["post_id", 1], ["post_id", 2], ["post_id", 3], ["post_id", 4], ["post_id", 5]] |
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
class Post < ApplicationRecord | |
has_many :comments | |
# we need to specify a new name, a lambda to filter the comments and the model class name | |
has_many :uncensored_comments, -> { where(censored: false) }, class_name: 'Comment' | |
end |
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
Post Load (0.5ms) SELECT "posts".* FROM "posts" | |
Comment Load (6.4ms) SELECT "comments".* FROM "comments" WHERE "comments"."post_id" = $1 AND "comments"."censored" = $2 [["post_id", 1], ["censored", false]] | |
Comment Load (0.5ms) SELECT "comments".* FROM "comments" WHERE "comments"."post_id" = $1 AND "comments"."censored" = $2 [["post_id", 2], ["censored", false]] | |
Comment Load (0.2ms) SELECT "comments".* FROM "comments" WHERE "comments"."post_id" = $1 AND "comments"."censored" = $2 [["post_id", 3], ["censored", false]] | |
Comment Load (0.2ms) SELECT "comments".* FROM "comments" WHERE "comments"."post_id" = $1 AND "comments"."censored" = $2 [["post_id", 4], ["censored", false]] | |
Comment Load (0.2ms) SELECT "comments".* FROM "comments" WHERE "comments"."post_id" = $1 AND "comments"."censored" = $2 [["post_id", 5], ["censored", false]] |
NewerOlder