Skip to content

Instantly share code, notes, and snippets.

# SYSTEM_SECRET should be equal to THIS_IS_THE_SECRET
THIS_IS_THE_SECRET = 'MY LITTLE SECRET'
# <YOUR NECESSARY CODE>
table_array = [
["brand", "year", "color"],
["specialized", 2001, "blue"],
["bianchi", 1999, "silver"] ,
["yetti", 2016, "red"]
]
@sebabelmar
sebabelmar / Passport Instagram Strategy.js
Created July 6, 2016 07:50
Passport Instagram Strategy for meanjs.or
'use strict';
/**
* Module dependencies.
*/
var passport = require('passport'),
InstagramStrategy = require('passport-instagram').Strategy,
users = require('../../controllers/users.server.controller');
module.exports = function(config) {
---------------- .bash_profile extract ---------------------
# Bash aliases
alias e=subl
alias be="bundle exec"
alias g=git
alias cl=clear
alias gpo="git push origin"
alias gph="git push heroku"
alias rials="rails"
alias gti="git"
# Bikes Factory
b1 = {brand: "scott", year: 2016, color: "red"}
b2 = {brand: "specialized", year: 2016, color: "blue"}
b3 = {brand: "Releigh", year: 2016, color: "white"}
arr = Bike.create_bikes_array([b1, b2, b3])
# arr = [< Instance of Bike 1>, <Instance of Bike 2>, <Instance of Bike 3>]
# Stretch print: ["scott", "specialized", "Releigh"]

The jQuery identifier (or $) is just a constructor function, and all instances created with it, inherit from the constructor's prototype.

###A simple constructor function:

function Test() {
  this.a = 'a';
}
Test.prototype.b = 'b';

var test = new Test(); 
setTimeout(function () {
(function ($) {
"use strict";
(function ($, window, document, undefined) {
var gridContainer = $('#grid-container'),
filtersContainer = $('#filters-container');
// init cubeportfolio

Code Reloading

The difficulties, or rather impossibilities, of doing in-process code reloading in Ruby have been well-documented.
There are many out-of-process reloading solutions. These all essentially reboot your application, reloading all dependancies.
This provides an obvious incentive to keep your application boot times as fast as possible.

Examples:

'Rerun launches your program, then watches the filesystem. If a relevant file changes, then it restarts your program. By default it watches files ending in: rb,js,coffee,css,scss,sass,erb,html,haml,ru,yml,slim,md,feature. Use the --pattern option if you want to change this.' - Doc U. Mentation Jr.

Ain't she sweet?!

Database Level

The skeletton that we used today has a connection on config/database.rb to a posgress DB if there is not set by ENV variable:

db = URI.parse(ENV['DATABASE_URL'] || "postgres://localhost/#{APP_NAME}_#{Sinatra::Application.environment}")

In that same file you can see that we set:

DB_NAME = db.path[1..-1]
def do_twice
yield
yield
end
# The basics
do_twice {puts "HOLA"}
def do_something_to_an_array (array)