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
package com.sexifit.android; | |
import java.io.IOException; | |
import java.io.StringReader; | |
import java.io.UnsupportedEncodingException; | |
import java.util.HashMap; | |
import javax.xml.parsers.DocumentBuilder; | |
import javax.xml.parsers.DocumentBuilderFactory; | |
import javax.xml.parsers.ParserConfigurationException; |
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 select2_select(text, options) | |
page.find("#s2id_#{options[:from]} a").click | |
page.all("ul.select2-results li").each do |e| | |
if e.text == text | |
e.click | |
return | |
end | |
end | |
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
require 'csv' | |
seed_data_path = "db/seed/" | |
puts "Importing shifts..." | |
CSV.foreach(Rails.root.join(seed_data_path + "shifts.csv"), headers: true) do |row| | |
%w(Monday Tuesday Wednesday Thursday Friday Saturday Sunday).each do |day| | |
Shift.find_or_create_by_day_and_start_time_and_end_time(day, Time.parse(row[0]), Time.parse(row[1])) | |
end | |
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
# select2_ajax helper to make capybara work with ajax-enabled Select2 elements | |
# assumes 'placeholder' option is used in Select2 (if it is using ajax, it should be) | |
# | |
# usage: | |
# | |
# it "should have a select2 field for searching by team name" do | |
# @team = Factory :team | |
# select2_ajax @team.name, :from => "Select a Team", :minlength => 4 | |
# click_button "Join" | |
# page.should have_content "You are now on '#{@team.name}'." |
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
!!! | |
%html | |
%head | |
%meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}/ | |
%title RailsCasts Weekly | |
:css | |
body, td { color:#000000; font-size:14px; font-family:Verdana,Helvetica,Arial; } | |
.divider { background-color:#555555; height:2px; } | |
.episode h2 { margin-top:0; margin-bottom:8px; font-size:18px; } | |
.episode p { margin:8px 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
class PdfMerger | |
def merge(pdf_paths, destination) | |
first_pdf_path = pdf_paths.delete_at(0) | |
Prawn::Document.generate(destination, :template => first_pdf_path) do |pdf| | |
pdf_paths.each do |pdf_path| | |
pdf.go_to_page(pdf.page_count) |
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
## This gist is intended to provide a code example for the | |
# 'Making Signed Requests' section of the 'Authentication Overview' document. | |
# (http://developer.netflix.com/docs/Security). | |
# | |
# We are going to make a catalog request. The hardest part of | |
# it is figuring out how to generate the oauth_signature. | |
require 'cgi' | |
require 'base64' | |
require 'openssl' |
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
# encoding: binary | |
require 'active_model/validator' | |
class EmailValidator < ActiveModel::EachValidator | |
EmailAddress = begin | |
qtext = '[^\\x0d\\x22\\x5c\\x80-\\xff]' | |
dtext = '[^\\x0d\\x5b-\\x5d\\x80-\\xff]' | |
atom = '[^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-' + | |
'\\x3c\\x3e\\x40\\x5b-\\x5d\\x7f-\\xff]+' |
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
<!DOCTYPE html> | |
<!--[if lt IE 7]> <html lang="en" ng-app="taskListApp" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> | |
<!--[if IE 7]> <html lang="en" ng-app="taskListApp" class="no-js lt-ie9 lt-ie8"> <![endif]--> | |
<!--[if IE 8]> <html lang="en" ng-app="taskListApp" class="no-js lt-ie9"> <![endif]--> | |
<!--[if gt IE 8]><!--> <html lang="en" ng-app="taskListApp" class="no-js"> <!--<![endif]--> |
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 /> | |
<script src="bower_components/modernizr/modernizr.js"></script> |
OlderNewer