Skip to content

Instantly share code, notes, and snippets.

View iheanyi's full-sized avatar
🪐
Working on databases @planetscale

Iheanyi Ekechukwu iheanyi

🪐
Working on databases @planetscale
View GitHub Profile
@iheanyi
iheanyi / routes.rb
Last active August 29, 2015 14:25
Stupid formatting error
get 'users/confirm', :to => "api/v1/users/confirmations#show", as: 'confirm'
# <%= confirm_url(@resource) %> as localhost:3000/users/confirm.1 (or whatever the id is). Any idea why?
@iheanyi
iheanyi / application_controller.rb
Created June 11, 2015 00:55
HTTP Authorization/Authentication Validators
class ApplicationController < ActionController::Base
#include Clearance::Controller
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :null_session, if: Proc.new { |c| c.request.format == 'application/json' }
before_filter :authenticate_user_from_token!
private
def authenticate_user_from_token!
authenticate_with_http_token do |token, options|
@iheanyi
iheanyi / adam-spec.md
Created May 29, 2015 02:25
Adam's CSS Classing Spec

First Letter

First Letter: Spacing Class (p or m)
Second Letter: Direction/Position (v/h, t/l/r/b)
Third Letter: Size (s (small), m (medium), l (large)

Example:
pbs = Padding Bottom Small,
mb = Margin Bottom

@iheanyi
iheanyi / sublime-config.json
Created May 19, 2015 21:44
Sublime Config
{
"bold_folder_labels": true,
"caret_extra_bottom": 2,
"caret_extra_top": 2,
"caret_extra_width": 2,
"caret_style": "phase",
"color_scheme": "Packages/User/SublimeLinter/base16-ocean.dark (SL).tmTheme",
"draw_white_space": "all",
"fade_fold_buttons": false,
"file_exclude_patterns":
@iheanyi
iheanyi / WhenToUseMVCFramework.md
Last active August 29, 2015 14:21
Outline for when to use a JS MVC Framework

Main Question

When should I start using a JS MVC framework for my front-end applications over a server-rendered application?

Ideas

When the UI/UX is somewhat complex

This means that you have nested routes or various components on your website that depend on data retrieved from the back-end. I found it harder to build maintable, ambitious UIs using only JQuery without losing my sanity.

@iheanyi
iheanyi / ember-angular-connects.md
Last active August 29, 2015 14:21
Drawing connections between Angular and Ember as I learn Angular.

Think of Angular Modules as an Ember Application

This is what defines your application and which controllers are a part of it.

Think of Angular Controllers as Ember Controllers

You can see the similarities between Ember controllers and Angular controllers. Attributes and functions defined within the Angular controller are responsible for updating the view. Similar to how actions in the front-end and attributes in Ember controllers are responsible for updating Ember's views.

Think of Angular Directives as Ember Components

Directives in Angular can be seen as components in Ember.JS, isolated in scope, attributes, and their templates. <directive [args...]> = {{component [args...}}

class RecipeCreator
attr_reader :recipe
def initialize(params)
@recipe = Recipe.new(params)
end
def save
saved = recipes.save
App.AccountEditRoute = Ember.Route.extend({
setupController: function(controller) {
controller.set('content', this.get('currentUser'));
}
});
@iheanyi
iheanyi / notre_dame_class_detail.rb
Last active August 29, 2015 14:10
Easy method of finding and determining corequisites, prerequisites, restrictions, and any other minor detail shown on the Notre Dame description page. If any of these details are returned as nil, then it does not have that specific attribute.
require 'nokogiri'
require 'faraday'
@term = "201420"
@crn = "14433"
@crn = "21129"
@crn = "22091"
@conn = Faraday.new(:url => 'https://class-search.nd.edu/reg/srch/ClassSearchServlet') do |faraday|
faraday.request :url_encoded
@iheanyi
iheanyi / README.md
Last active August 29, 2015 14:10 — forked from dwtkns/README.md

Building on this - experimenting with fake 3d svg arcs using two nested orthographic projections and cardinal line interpolation.