Skip to content

Instantly share code, notes, and snippets.

View dangalipo's full-sized avatar

Dan Galipo dangalipo

View GitHub Profile
@dangalipo
dangalipo / HomeController.rb
Created January 21, 2013 08:11
uiimageview
def setupHomeImage
homeImage = UIImageView.alloc.initWithImage(UIImage.alloc.initWithContentsOfFile(File.join(App.resources_path, 'home.png')))
homeImage.frame = CGRectMake(0, -8,self.view.size.width, 290)
homeImage.contentMode = UIViewContentModeScaleAspectFit
self.view.addSubview homeImage
end
@dangalipo
dangalipo / account_controller_spec.rb
Created January 14, 2013 08:04
ano_controller_with_params
controller do
skip_authorization_check
def test
render nothing: true
end
end
@dangalipo
dangalipo / case_helper_spec.rb
Created November 14, 2012 07:03
helper test
describe 'options_for_input' do
subject { options_for_input field }
before(:each) do
mock(helper).translated_label(anything) { 'label' }
mock(helper).select_options(anything) { ['option'] }
end
context 'field is a boolean' do
def self.process_map_reduce(query)
debugger
query.find.to_a.inject({}) do |acc, current|
acc[current['_id']] = current['value']; acc
end
end
@dangalipo
dangalipo / original
Created October 23, 2012 01:26
map reduce
Form.map_reduce(mr.map_incorrect_count, mr.reduce_sum)
---
map_incorrect_count:
"function() {
if(!this.components) return;
this.components.forEach(function(c) {
if(c.verification_result === 'incorrect') {
emit(c.short_label, 1);
}
startLiveDataSyncing: ->
window.setInterval GotApp.SearchFilter.current().search(null, false), (5 * 60 * 1000) # 5min
class GotApp.SearchVenuesController extends Panel
title: I18n.t('title')
className: 'search-venues'
className : 'search-venues'
elements :
'.last-search' : 'elLastSearchButton'
'.search-venues-day-of-week' : 'elSearchVenuesDayOfWeek'
'#search-venue-filter-list' : 'filterList'
class Foo
constructor:(@a) ->
bar:
funcA: ->
console.log @a
objA = new Foo('hello')
objB = new Foo('hello')
@capacitySort: (v1, v2) ->
if v1.capacity.live && v2.capacity.live
if parseFloat(v1.capacity.live) >= parseFloat(v2.capacity.live) then -1 else 1
else if v1.capacity.live || v2.capacity.live
if parseFloat(v1.capacity.live) >= parseFloat(v2.capacity.live) then -1 else 1
else
day = GotApp.SearchFilter.current().day
if parseFloat(v1.capacity[day]) >= parseFloat(v2.capacity[day]) then -1 else 1
class UpdatingAnExistingObject < Spinach::FeatureSteps
include SharedPaths
include SharedForms
include SharedObject
include SharedAuthentication
When "I click the object's name" do
click_link @object.name
end