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
defmodule OutandbackWeb.RaceSearchLive do | |
use OutandbackWeb, :live_view | |
import Ecto.Query | |
alias Outandback.Events.Race | |
@per_page 9 | |
def render(assigns) do |
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 python | |
# encoding: utf-8 | |
""" | |
captchasolver.py | |
This module provides mathematic captcha solvers. | |
Created by Pradeep Gowda on 2008-04-22. | |
Copyright (c) 2008 Watchdog.net. All rights reserved. | |
""" |
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
def to_csv(options={}) | |
header_row = [ | |
'Response ID', | |
'Timestamp (MM/dd/yyyy)', | |
'Time Taken to Complete (Seconds)', | |
] | |
self.questions.each_with_index do |q, i| | |
header_row << "Q#{i+1}" | |
end |
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
module RssHelper | |
def rss_links | |
body = HTTParty.get('http://blog.slimsurveys.com/feeds/posts/default?alt=rss') | |
items = [] | |
begin | |
Nokogiri::XML(body).xpath('//item').slice(0, 5).each do |item| | |
items << content_tag(:a, item.xpath('title').inner_text, href: item.xpath('link').inner_text.to_s ) | |
end |
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
Mod.ChartView = Ember.View.extend({ | |
tagName: 'canvas', | |
attributeBindings: ['width', 'height'], | |
width: '200px', | |
height: '200px', | |
didInsertElement: function() { | |
var project = this.get('context'); | |
var issues = project.get('issues').toArray(); | |
var data = []; | |
var closed = 0; |
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
version :medium, :if => :is_landscape? do | |
process :resize_to_fit => [270, 0] | |
end | |
version :medium, :if => :is_landscape? do | |
process :resize_to_fit => [0, 270] | |
end | |
def is_landscape? picture | |
image = ::Magick::Image.read(picture.path).first |
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
Template.project_issues.events = { | |
'keydown input[name="issue[title]"]': function(event) { | |
if(event.which == 13) { | |
Issues.insert({ | |
title: event.target.value, | |
projectId: Session.get('currentProjectId'), | |
milestoneId: '' | |
}); | |
event.target.value = ''; |
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
Template.project_issues.milestones = function() { | |
milestones = Milestones.find({projectId: Session.get('currentProjectId')}).fetch(); | |
milestones.forEach(function(milestone) { | |
issues = Issues.find({projectId: Session.get('currentProjectId')}).fetch(); | |
milestone.issues = []; | |
milestone.issues.push(issues); | |
}); | |
return milestones; |
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
# Controller | |
def publish | |
trip = Trip.find(params[:id]) | |
trip.status = 'published' | |
trip.save! | |
redirect_to account_trips_path, notice: 'Your trip is now live!' | |
end | |
# Routes |
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
def coupon | |
begin | |
coupon = Recurly::Coupon.find(params[:code]) | |
rescue | |
head 404 | |
return | |
end | |
render json: coupon | |
end |
NewerOlder