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 / 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 / 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 / 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 / first-job.md
Created July 31, 2015 17:23
Things to Consider When Choosing a First Job

How to Choose Your First Job

I'm all for letting people learn from my mistakes, that's pretty crucial. So, I'm going to write a blog post on things to consider when choosing your first job. For those who are lucky to have multiple options, it is kind of an important decision, because this first job is crucial for your professional growth and development. So what are factors you should take into consideration when choosing your first job and to come to a decision? Well, I'm about to let you know.

@iheanyi
iheanyi / sessions_controller.rb
Created July 31, 2015 19:09
User Authentication junts.
class Api::V1::Users::SessionsController < Devise::SessionsController
skip_before_filter :verify_authenticity_token, :only => [:create, :destroy]
skip_before_filter :verify_signed_out_user, only: :destroy
def check_current_user
if @user.signed_in?
render json: current_user, status: :ok
else
render json: {user: nil}, status: :ok
end
@iheanyi
iheanyi / api.ex
Created December 13, 2015 04:07
Elixir stuff
defmodule API do
alias Utils
@base_url "https://class-search.nd.edu/reg/srch/ClassSearchServlet"
@doc """
Initialize the initial page and everything.
"""
def initialize(page \\ :initial) do
API.Search.start_link(page)
end
<div class="row">
<div class="col-sm-8 table-wrapper">
{{#vertical-collection
tagName="li"
content=pages
defaultHeight=350
useContentProxy=true
lastReached="loadBelow"
containerSelector=".table-wrapper"
as |page|
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
events: [
{
title: 'Egghead Recording',
allDay: true,
date: Date.now(),
}
@iheanyi
iheanyi / application.controller.js
Last active January 18, 2016 17:31
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Dynamic Components Example',
currentModal: null,
showModal: Ember.computed('currentModal', function() {
return !!this.get('currentModal');
}),
actions: {
openModalA() {