Skip to content

Instantly share code, notes, and snippets.

View jackdempsey's full-sized avatar

jack dempsey jackdempsey

View GitHub Profile
angular.module("FundooDirectiveTutorial", []).controller("FundooCtrl", ($scope, $window) ->
$scope.rating = 5
$scope.saveRatingToServer = (rating) -> $window.alert "Rating selected - " + rating
).directive "fundooRating", ->
restrict: "A"
template: "<ul class=\"rating\">" + "<li ng-repeat=\"star in stars\" ng-class=\"star\" ng-click=\"toggle($index)\">" + "★" + "</li>" + "</ul>"
scope:
ratingValue: "="
max: "="
readonly: "@"
scala> Json.toJson((1, 2))
<console>:20: error: No Json deserializer found for type (Int, Int). Try to implement an implicit Writes or Format for this type.
Json.toJson((1, 2))
^
scala> implicit val x = new Writes[(Int, Int)] {
| def writes(t: (Int, Int)): JsValue = {
| JsArray(Seq(JsNumber(t._1), JsNumber(t._2)))
| }
| }
Hi Jack,
Ever watch someone’s head explode because they get so excited about what they are doing? Every manager and candidate I talk to
says they want PASSION in the people they hire, the people they work with, and the position they hold. But when I actually speak
with an individual who can CONVEY that passion and not just mouth the words, it’s a real treat. So I’m talking to this manager,
and when we challenge her on the passion part, man did she go off. I mean wow. So it’s a software developer position. The
descriptions are basically the same. RubyRubyRubyRuby. Ruby Tuesday, Ruby will you be mine, Jack Ruby, Ruby on rails, Ruby don’t
bring your love to town, Ruby Red, Ruby Web, Ruby Mobile. But what you will be doing, what you will be working on, what you will
discover, what you will learn…Its impossible to convey the excitement this person displayed, the descriptions she gave, the
PASSION she felt for her company and product. This a social media acorn waiting to grow into an oak tree of aggregated real ti
@jackdempsey
jackdempsey / gist:5913815
Last active December 19, 2015 06:49
I'm looking for a word that is defined by the following:
__________ - noun
a situation where one relatively small change can influence the
potential energy of an outcome by orders of magnitude.
example: if you have a fair coin and flip it, you have a 50/50 shot of
heads or tails. An intelligent person would not place wagers on this game if played to infinity.
If you change the weighting and make it 49/51 then that intelligent person
1 var fallacy_buttons = "<a href='#' onclick='$(\".usertext-edit textarea\").val(\"https://yourlogicalfallacyis.com/strawman\");'>strawman</a> | " +
2 "<a href='#' onclick='$(\".usertext-edit textarea\").val(\"https://yourlogicalfallacyis.com/false-cause\");'>false-cause</a>"
3 var buttons = "<div id='logical_fallacy' style='background-color: lightgrey'>" + fallacy_buttons + "</div>";
4
5 $("#header-bottom-left").after(buttons);
foo = ->
alert 'it has it'
@jackdempsey
jackdempsey / config_initializers_active_admin.rb
Created September 5, 2012 01:48
How to define controller methods in one place for ActiveAdmin
109 class ActiveAdmin::BaseController
110 def current_ability
111 @current_admin_ability ||= AdminAbility.new(current_admin_user)
112 end
113
114 def user_for_paper_trail
115 current_admin_user
116 end
117
118 def info_for_paper_trail
@jackdempsey
jackdempsey / gist:3200090
Created July 29, 2012 16:34
Chatting about rails-api
I'm wondering what speed benefits using rails-api gives you over the normal rails stack. Conceptually it makes sense that removing unneeded pieces will help, but most of the default rails middleware is still in place, so I'm wondering if the boost is actually noticeable.
Removing those pieces does restrict your ability to use things like active_admin to manage your data, so I'd only go with the slimmer rails-api style project if the improvements are noticeable.
git rm `git status | grep deleted | cut -f2 -d: | xargs`
= form_for @list do |f|
no routes matches /lists
= form_for @list, url: (@list.new_record? ? lists.lists_path : lists.list_path(@list) do |f|