This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# stored in app/presenters/student_presenter.rb | |
class StudentPresenter < SimpleDelegator | |
delegate :email, to: :user | |
def initialize(student) | |
@student = super(student) | |
end | |
def self.find(id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):013:0> a = [] | |
=> [] | |
irb(main):014:0> a |= [1] | |
=> [1] | |
irb(main):015:0> a |= [1] | |
=> [1] | |
irb(main):016:0> a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'prime' | |
class AdditiveFunctionValidator | |
attr_reader :limit, :prime_numbers | |
def initialize(limit:) | |
@limit = limit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s3.buckets['kickdrop-production-assets'].objects['uploads/'].copy_to('uploads/', :bucket_name => 'kickdrop-staging-assets') | |
source_bucket='kickdrop-production-assets' | |
target_bucket='kickdrop-staging-assets' | |
source_key = 'uploads' | |
target_key = 'uploads' | |
bucket1 = s3.buckets[source_bucket] | |
bucket2 = s3.buckets[target_bucket] | |
obj1 = bucket1.objects.with_prefix("uploads") | |
obj2 = bucket2.objects.with_prefix("uploads") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Send subscriber data to MailChimp | |
MailChimpSubscription.save( | |
// Successfully sent data to MailChimp. | |
function (response) { | |
// Define message containers. | |
mailchimp.successMessage = ''; | |
mailchimp.errorMessage = ''; | |
// Store the result from MailChimp | |
mailchimp.result = response.result; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
url = '//' + mailchimp.username + '.' + mailchimp.dc + '.list-manage.com/subscribe/post-json'; | |
params = { | |
'EMAIL': mailchimp.email, | |
'FNAME': mailchimp.fname, | |
'LNAME': mailchimp.lname, | |
'c': 'JSON_CALLBACK', | |
'u': mailchimp.u, | |
'id': mailchimp.id | |
}; | |
actions = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input class="hidden" type="hidden" ng-model="mailchimp.username" ng-init="mailchimp.username='kickdrop'"> | |
<input class="hidden" type="hidden" ng-model="mailchimp.dc" ng-init="mailchimp.dc='us3'"> | |
<input class="hidden" type="hidden" ng-model="mailchimp.u" ng-init="mailchimp.u='425ab2b3e010a637cca296582'"> | |
<input class="hidden" type="hidden" ng-model="mailchimp.id" ng-init="mailchimp.id='d2686186f0'"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css"> | |
<link href="css/app.css" media="all" rel="stylesheet"> | |
<link href="bower_components/animate.css/animate.min.css" media="all" rel="stylesheet" type="text/css" /> | |
<link href="css/animations.css" media="all" rel="stylesheet"> | |
<link href="bower_components/font-awesome/css/font-awesome.min.css" media=all rel=stylesheet /> | |
<link href='http://fonts.googleapis.com/css?family=Lato:100,300,400' rel='stylesheet' type='text/css'> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body> | |
... | |
<!-- In production use: | |
<script src="//ajax.googleapis.com/ajax/libs/angularjs/x.x.x/angular.min.js"></script> | |
--> | |
<script src="bower_components/angular/angular.js"></script> | |
<script src="bower_components/angular-route/angular-route.js"></script> | |
<script src="bower_components/angular-cookies/angular-cookies.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.addList = function() { | |
var newList = $scope.newList.trim(); | |
if (!newList.length) { | |
return; | |
} | |
lists.push({ | |
listId: Slug.slugify(newList + '-' + lists.length), | |
title: newList, |