Skip to content

Instantly share code, notes, and snippets.

View bryanaka's full-sized avatar
👨‍🎤

Bryan Robles bryanaka

👨‍🎤
View GitHub Profile
@bryanaka
bryanaka / group_by_time_range.coffee
Created March 27, 2014 22:47
rough group by time range computed property
Ember.computed.groupByTimeRange = (dependantArrayKey, dependantChildKey, hourRange) ->
dependantProperty = "#{dependantArrayKey}.@each.#{dependantChildKey}"
Em.computed( ->
# hash by dates
activityItemsHash = {}
activityItems = @get(dependantArrayKey).sortBy(dependantChildKey)
groupedActivityItems = []
activityItems.forEach (activity, index, activities) =>
hashPosition = null
@bryanaka
bryanaka / challenge.md
Last active December 30, 2015 06:59
PBD Student Challenge

Student Challenge

This is a short quiz to make sure you have the fundamentals in place to apply for our position. Please email your answers to pbdwebmaster@lbl.gov when finished. This shouldn't take you longer than 20 minutes.

Just a few guidelines:

  • Take into consideration both functionality and style.
@bryanaka
bryanaka / Gemfile
Last active December 30, 2015 05:28
Revolutionize Testing Challenge
source "https://rubygems.org"
gem "httparty"
@bryanaka
bryanaka / hash_lesson.md
Created November 27, 2013 22:07
hash_lesson for GA

Hash

The next data structure we are going to talk about is a hash. Hashes are fundamental in Ruby, and very important when it comes to Ruby Web Programing. You will see them used a lot in frameworks like Rails and Sinatra.

Basic Syntax

Locations = new Meteor.Collection2('Locations', {
schema: {
country: {
type: String,
label: 'Country',
max: 50
},
city: {
type: String,
label: 'City',
@bryanaka
bryanaka / ShowTravelController.js
Created October 31, 2013 16:59
IronRouter and Meteor Subscription Problems
// TravelController.show was commented out when using this controller
ShowTravelController = ApplicationController.extend({
waitOn: function() {
var id = this.params._id;
return [Meteor.subscribe('singleTravelRequest', id)];
},
action: function() {
// tried this one too
// this.waitOn = Meteor.subscribe('singleTravelRequest', this.params._id);
@bryanaka
bryanaka / karma_testconfig.js
Created October 7, 2013 07:44
Karma Test Runner Config for promise.js
// Karma configuration
// Generated on Sat Oct 05 2013 23:52:56 GMT-0700 (PDT)
module.exports = function(config) {
config.set({
// base path, that will be used to resolve files and exclude
basePath: '',
@bryanaka
bryanaka / promise.js
Last active December 24, 2015 21:09
A very simple promise demonstration. Tests can be run using Jasmine and Karma Test Runner. Karma Config posted at https://gist.github.com/bryanaka/6863961
/* jshint undef: true, unused: true */
(function(window) {
'use strict';
var Promise = function () {
this.state = 'pending';
this._successHandlers = [];
this.values = null;
};
@bryanaka
bryanaka / rotational_cipher.rb
Created October 7, 2013 07:17
Rotational Cipher for a Technical Challenge
class RotationalCipher
def initialize(offset)
while offset > 26
offset -= 26
end
generate_cipher_map(offset)
end
class << self