This file contains hidden or 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
#What’s the issue with the controller code below? How would you fix/improve it? | |
class CommentsController < ApplicationController | |
... | |
def users_comments | |
posts = Post.all | |
comments = posts.map(&:comments).flatten | |
@user_comments = comments.select do |comment| | |
comment.author.username == params[:username] |
This file contains hidden or 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
/* eslint-disable no-console */ | |
module.exports = class Handler { | |
constructor() { | |
this.queue = []; | |
this.initialized = false; | |
} | |
initialize() { | |
if (this.initialized) { |
This file contains hidden or 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
# database tables schema | |
tables: | |
# "Guide" rows will be created with data from swagger, we can have rake task that loads data from swagger after deploy | |
# we shoulda have a uniq validation of [slug, vertion] so we can select/display diferent version for a guide. | |
# need to figure out how to index the guides nested in a way that makes it possible to find guides based on resources and endpoints | |
guides: we search in this level... | |
description: 'bla bla bla...' #swagger.info.description # | |
title: 'Salesforce' #swagger.info.title | |
slug: 'sobject' #id of the swagger config | |
version: '1.0.0' # swagger.info.version # 1.0.0 |
This file contains hidden or 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
navigation: [ | |
{title: 'Account', href: '/guides/account'}, | |
... | |
], | |
resources: { | |
'account': { | |
title: 'Account', // x-sfdc-ia-resource | |
slug: 'account', // parameterized version of x-sfdc-ia-resource | |
endpoints: [ |
This file contains hidden or 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
$static-font-path: "salesforce-lightning-design-system/assets/fonts/webfonts/"; | |
// This is needed to fix loadind fonts | |
// https://github.com/salesforce-ux/design-system/issues/71 | |
@mixin set-slds-font($name, $file, $weight: 400, $style: normal) { | |
@font-face { | |
font-family: $name; | |
font-weight: $weight; | |
font-style: $style; | |
src: font-files( |
This file contains hidden or 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
# this command syncs docker-machine running on virtualbox with your current working directory | |
# replace "/app/user" with the path where your app will be mounted on the docker container | |
# $(pwd) this will return your local folder and sync it with the equivalen folder on virtualbox | |
# make sure to stop your docker-machine before running this command | |
VBoxManage sharedfolder add DFC --automount --name /app/user --hostpath $(pwd) |
This file contains hidden or 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
// **** Framework ******* | |
function createAction(reducer) { | |
const subject$ = new Rx.Subject(); | |
return { | |
dispatch (payload) { | |
subject$.onNext(payload); | |
}, | |
stream$: subject$.map((payload) => { |
This file contains hidden or 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
import {setEntries, next, vote, INITIAL_STATE} from './core'; | |
// This is a polymorphic aprorach that conforms to all SOLID principles | |
// This reduce is much simpler and will raise an error if the action does not exist | |
export default function reducer(state = INITIAL_STATE, action) { | |
return action.handler(state, action.payload); | |
} | |
// This is the defensive version of the reducer above, if there is an error returns the current state | |
export default function maybeReducer(state = INITIAL_STATE, action) { |
This file contains hidden or 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
// ---- | |
// Sass (v3.4.7) | |
// Compass (v1.0.1) | |
// ---- | |
$list: ( | |
(a: ".div-1", b: (a: 100px)), | |
(a: ".div-2", b: (a: 200px)), | |
(a: ".div-3", b: (a: 300px)), | |
); |
This file contains hidden or 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 Tower | |
def initialize(name, rings) | |
@name = name | |
@rings = rings | |
end | |
def to_s | |
@name | |
end |
NewerOlder