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
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
}
}
apply plugin: 'android'
@iheanyi
iheanyi / Professor Sections Reset
Last active August 29, 2015 14:08
Counter Caches and HABTM
[5] pry(main)> Professor.reset_counters(4, :sections)
Professor Load (1.1ms) SELECT "professors".* FROM "professors" WHERE "professors"."id" = $1 LIMIT 1 [["id", 4]]
(0.4ms) SELECT COUNT(*) FROM "sections" WHERE "sections"."professor_id" = $1 [["professor_id", 4]]
(0.7ms) UPDATE "professors" SET "courses_count" = 12 WHERE "professors"."id" = 4
=> true
# Notice how it is updating the Courses Count, when I want this to be sections_count updated. :/
int switchState = 0;
void setup() {
switchState = digitalRead(2);
}
void loop() {
pinMode(3, OUTPUT);
@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.

@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
App.AccountEditRoute = Ember.Route.extend({
setupController: function(controller) {
controller.set('content', this.get('currentUser'));
}
});
class RecipeCreator
attr_reader :recipe
def initialize(params)
@recipe = Recipe.new(params)
end
def save
saved = recipes.save
@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...}}

@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 / 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":