Skip to content

Instantly share code, notes, and snippets.

View jalcine's full-sized avatar
💭
Decentralize and democratize the Web.

Jacky Alciné jalcine

💭
Decentralize and democratize the Web.
View GitHub Profile

#Ruby Interview Questions

What are blocks for?

Plain old english: Ways of grouping code we want to run. The simplest explanation for a block is that it is a chunk of code between {} or do...end, that can't be stored in a variable and isn't an object. A block is just part of the syntax of a method call. It doesn’t mean anything on a standalone basis and can only appear in argument lists.

What are the difference between p and puts?

The difference is subtle, but p prints the true value of an object, rather than a string-ified version of the object. This will make more sense soon, but for the sake of simplicity, we'll use the p command throughout the exercises, as we'll want to see the true values of our code returned to the output window.

#define _CRT_SECURE_NO_WARNINGS // turn off SAFE COMMANDS
// ############################
// Written By: Cristian Colocho
// Date Written: March, 14, 2015
// Purpose: Loop Menu and Switch
// ############################
#include <stdio.h>
#include <stdlib.h>
#define PAUSE system("pause");
@jalcine
jalcine / SECURITY.md
Last active August 29, 2015 14:16 — forked from Najaf/SECURITY.md

Security inspections

At the beginning of each month, we carry out a brief, high-level security inspection. The purpose is to be a sanity check for head-slapping, trivial vulnerabilities that no one expected would be in the code but somehow managed to creep in anyway.

Who's responsible?

One of @alice, @bob or @charlie should do the inspection if no one else has the time.

How often?

@media (min-width:320px) { /* smartphones, portrait iPhone, portrait 480x320 phones (Android) */ }
@media (min-width:480px) { /* smartphones, Android phones, landscape iPhone */ }
@media (min-width:600px) { /* portrait tablets, portrait iPad, e-readers (Nook/Kindle), landscape 800x480 phones (Android) */ }
@media (min-width:801px) { /* tablet, landscape iPad, lo-res laptops ands desktops */ }
@media (min-width:1025px) { /* big landscape tablets, laptops, and desktops */ }
@media (min-width:1281px) { /* hi-res laptops and desktops */ }

Architectural Questions

  • Are responsibilities well defined?
  • Are the collaborations well defined?
  • Is coupling minimized?
  • Can you identify potential duplication?
  • Are interface definitions and constraints acceptable?
  • Can modules access needed data—when needed?

Subway Info

##Preview

Screenshot 1: https://raw.github.com/parthibanloganathan/dashing_widgets/master/public/mta1.png Screenshot 2: https://raw.github.com/parthibanloganathan/dashing_widgets/master/public/mta2.png

Description

Subway Info is a Dashing widget which displays information on trains in New York City. Information includes train line, direction, station and arrival time. You can customize it to include any combination of lines and stations. This may also be used in other cities as well if you have the appropriate GTFS files.

factory :user do
name "Jessie Pinkman"
email
password "secret"
password_confirmation "secret"
factory :group_admin, parent: :user do
after(:create) do |user, evaluator|
group = evaluator.respond_to? :group ? evaluator.group : create(:group)
user.add_role :admin, group
factory :user do
name "Jessie Pinkman"
email
password "secret"
password_confirmation "secret"
trait :group_admin do
ignore do
group = nil
end
factory :user do
name "Jessie Pinkman"
email
password "secret"
password_confirmation "secret"
factory :group_admin, parent: :user do
ignore do
group = nil
end

Using better_errors on Ubuntu with SublimeText 2

After I installed the fantastic better_errors gem, I was disappointed to notice that linking to your text editor doesn't work correctly on Ubuntu (at least, it didn't for me). Here's how I fixed it.

First, create a new desktop entry:

# /usr/share/applications/subl-urlhandler.desktop