Skip to content

Instantly share code, notes, and snippets.

View Mariusio's full-sized avatar
💭
🏝

Marius Mariusio

💭
🏝
View GitHub Profile
@Mariusio
Mariusio / question2.1.txt
Created March 18, 2020 12:44
Pexels - Applicant Qualification Test
### Question 2.1
1. In the show action of PostsController we create a new instance variable called "@post" and use the ActiveRecord ORM to generate a SQL query for our database that returns a collection of all entries in the "posts" table that have attribute "published = true" and where the "id" attribute from the "params" hash matches the "id" of the "post" entry.
We then use the ORMs "first" method to select the first object from the collection.
In the next line we check if "@post" is undefined or nil. If it is we set "@post" to the newest / latest entry in the database.
In the "posts/show" view we iterate over the "comments" for a "post" (usually identified by "post_id" attribute on "comment"), insert a paragraph for each comment and fetch and display the "user.name" and the "text" of the "comment".
class Array
# require and extend MiniTest for test_custom_flatten method
require 'test/unit/assertions'
extend Test::Unit::Assertions
# custom_flatten flattens an n-dimensional array and
# returns a single dimensional array.
#
# custom_flatten only works with arrays
# where each element is either an Integer or a
0x222c914EEaA8e6010A74411C36Ac7b2c0a59CB01
var args = require('minimist')(process.argv.slice(2));
var username = args.username;
var timeframe = args.timeframe;
var moment = require('moment');
var InstagramPosts, streamOfPosts;
InstagramPosts = require('instagram-screen-scrape').InstagramPosts;
streamOfPosts = new InstagramPosts({
ember-cli-sentry will not be loaded from bower installation
Livereload server on http://0.0.0.0:5000
Serving on http://0.0.0.0:4000/
broccoli-babel-transpiler is opting out of caching due to a plugin that does not provide a caching strategy: `function (babel) {
var t = babel.types;
var replaceNodeWithPrecompiledTemplate = function(node, template) {
var compiledTemplateString = "Ember.HTMLBars.template(" + precompile(template) + ")";
// Prefer calling replaceWithSourceString if it is present.
// app/services/pusher.js
channel.bind('executionStatus', (payload) => {
// find report with this executionId
const reports = this.get('store').peekAll('report');
reports.forEach((report) => {
if (report.get('executionId') === payload.execution_id) {
if (payload.event === 'success') {
{
"attribution":"<a href=\"https://www.mapbox.com/about/maps/\" target=\"_blank\">&copy; Mapbox</a> <a href=\"https://openstreetmap.org/about/\" target=\"_blank\">&copy; OpenStreetMap</a> <a class=\"mapbox-improve-map\" href=\"https://www.mapbox.com/map-feedback/\" target=\"_blank\">Improve this map</a>",
"bounds":[
-180,
-85,
180,
85
],
"created":1415246400000,
"description":"",
var assert = require('assert');
var printer = require('.');
var fs = require('fs');
var path = require('path');
var mapnik = require('mapnik');
var url = require('url');
var tilelive = require('tilelive');
var tileliveVector = require('tilelive-vector');
var tileliveTmstyle = require('tilelive-tmstyle');
{{#power-select
selected=report.dashboardId
options=myDashboards
placeholder="Select a dashboard"
onchange=(action (mut report.dashboardId) value=dashboard.id)
as |dashboard|
}}
{{dashboard.name}}
{{/power-select}}
// app/controllers/datasources/index.js
// 1
datasources: Ember.computed.sort('model', 'name')
=> Uncaught Error: Assertion Failed: The sort definition for 'datasources' must be a function or an array of strings
// 2
datasources: Ember.computed.sort('model', ['name'])
=> Uncaught Error: Assertion Failed: The key provided to get must be a string, you passed name