Skip to content

Instantly share code, notes, and snippets.

if ['Client Viewer', 'Client Reviewer'].include?(@invitation.role)
auto_login
elsif @invitation.new_collaborator?
password_reset_link
else
direct_link
end
logme: (->
console.log("do stuff")
).on("init")
Arc9.CommentsCommentsPopupController = Ember.Controller.extend
myVar: (->
"stuff"
).property()
actions:
doThis: ->
alert("i did it!")
module RailsAdmin::Collaborator
extend ActiveSupport::Concern
def self.extended(base)
base.class_eval do
rails_admin do
field :full_name
field :email
field :company
end
@apolzon
apolzon / gist:11305497
Created April 25, 2014 22:37
angular character count directive
HuntersAlley.directive "haCharacterCount", [ ->
scope:
object: "="
maxlength: "@"
template: """
<div class='listing-form__charactersRemaining'>
<span>Characters remaining:</span>
<span class='listing-form__count' ng-class="{'listing-form__countDanger': (maxlength - object.length) < 11}">
{{maxlength - object.length}}
</span>
@apolzon
apolzon / sidekiq_filter.rb
Created January 31, 2014 00:16
Filter some sidekiq jazz
enqueued = Sidekiq::Queue.new
scheduled = Sidekiq::ScheduledSet.new
retries = Sidekiq::RetrySet.new
# use whichever queue you expect your job to be in, example is for scheduled:
my_jobs = scheduled.map(&:item).select do |job|
job["class"] == "Listing::Worker::End" &&
job["args"].last == 33952
# job["args"] is an array like:
def initialize(o, options = {})
o = o.decorate
super
end
@apolzon
apolzon / gist:6939522
Last active December 25, 2015 07:29
naked and extend example
Cerego.controller "GroupAdminCtrl", ($scope, $routeParams, $filter, GroupUsersResource,
GroupsResource, GroupsService, GoalListSearchResource,
GoalSearchResource) ->
# using underscore.extend to set some defaults on the $scope; this is sorta naked as well in the sense that I believe it gets executed on initialization of the controller
_.extend $scope,
group_id : $routeParams.group_id
group : GroupsService.group
... omitted lots of stuff ...
@apolzon
apolzon / status
Created September 20, 2013 17:04
Quick status for OKL
#!/bin/zsh
cd ~/dev/okl
pwd
for i in * ; do
( cd $i
if [ "$i" = "hunters-alley-chef" ] || [ "$i" = "hunters-alley-dev" ] || [ "$i" = "hunters-alley-ios" ] || [ "$i" = "hunters-alley-docs" ] ; then
continue
fi
dirname=$i
module HuntersAlley::Core
class Application < Rails::Application
console do
ActiveRecord::Base.default_timezone = :utc
# ActiveRecord::Base.logger = Base.logger
ActiveRecord::Base.configurations = { HuntersAlley.env => Rails.configuration.database_configuration[HuntersAlley.env] }
ActiveRecord::Base.establish_connection(HuntersAlley.env)
end
end
end