This file contains hidden or 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
| {-# LANGUAGE OverloadedStrings #-} | |
| module Lib where | |
| import Text.HTML.Scalpel | |
| import Data.Maybe (fromMaybe) | |
| import Data.Char | |
| import Control.Applicative | |
| import Text.Read (readMaybe) |
This file contains hidden or 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
| import Ember from 'ember'; | |
| export default Ember.Controller.extend({ | |
| session: Ember.inject.service('session'), | |
| sessionAccount: Ember.inject.service(), | |
| actions: { | |
| authenticate() { | |
| let {email, password} = this.getProperties('email', 'password'); | |
| this.get('session').authenticate('authenticator:devise', email, password) |
This file contains hidden or 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
| import Ember from 'ember'; | |
| import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mixin'; | |
| const { service } = Ember.inject; | |
| export default Ember.Route.extend({ | |
| sessionAccount: service('session-account'), | |
| beforeModel() { | |
| return this._loadCurrentUser(); |
This file contains hidden or 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
| import Ember from 'ember'; | |
| const { inject: { service }, RSVP } = Ember; | |
| export default Ember.Service.extend({ | |
| session: service(), | |
| store: service(), | |
| loadCurrentUser() { | |
| return new RSVP.Promise((resolve, reject) => { |
This file contains hidden or 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
| import Devise from 'ember-simple-auth/authenticators/devise'; | |
| export default Devise.extend({ | |
| tokenAttributeName: 'authentication_token' | |
| }); |
This file contains hidden or 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
| <style> | |
| .dumb { | |
| color: chartreuse; | |
| background-color: red; | |
| } | |
| </style> | |
| <!DOCTYPE html> | |
| <html lang="en"> |
This file contains hidden or 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
| class Photo < ActiveRecord::Base | |
| has_many :profiles | |
| has_attached_file :photo, :styles => { :medium => "300x300", :large => "500x500", :thumb => "100x100" }, :s3_host_name => 's3-us-west-2.amazonaws.com' | |
| validates_attachment_content_type :photo, :content_type => /\Aimage\/.*\Z/ | |
| validates_with AttachmentSizeValidator, attributes: :photo, less_than: 5.megabytes | |
| validates_attachment_presence :photo, presence: true |
This file contains hidden or 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
| def find_missing(array) | |
| (0..100).inject(:+) - array.inject(:+) | |
| end |
This file contains hidden or 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
| def perm(string) | |
| array = [] | |
| until array.length == factorial(string) | |
| array << string.chars.shuffle.join | |
| array.uniq! | |
| end | |
| array.sort | |
| end | |
| def factorial(string) |
This file contains hidden or 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
| web: bundle exec rackup config.ru -p $PORT |