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 ApplicationController < ActionController::Base | |
before_filter unless: :devise_controller? do | |
resource = controller_name.singularize.to_sym | |
method = "#{resource}_params" | |
params[resource] &&= send(method) if respond_to?(method, true) | |
end | |
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
- (void)locationManager:(CLLocationManager*)manager | |
didUpdateHeading:(CLHeading*)newHeading { | |
// If the accuracy is valid, process the event. | |
if (newHeading.headingAccuracy > 0) { | |
/** | |
* The orientation affects the compass. We need to actually | |
* base the orientation off of the top of the iPhone. Think | |
* of the direction the phone is facing when you hold it right |
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
/** | |
* This example programatically generates a series of UIViews each | |
* 244x2000 and stacks them vertically inside of a scroll view. | |
* To do this we dynamically build a dictionary as we generate | |
* the views and simultaneously build an array of height | |
* constraints. Once the loop has completed we combine all of the | |
* constraints into a single string and apply the last constraint | |
* to the scrollview. | |
* | |
* This example assumes you're working in a UIViewController with |
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
// | |
// Get direction | |
// | |
this.getDirectionFromBearing = function(bearing) { | |
if (bearing > 330 || bearing <= 15) { | |
return "N"; | |
} else if (bearing > 15 || bearing <= 60) { | |
return "NE"; | |
} else if (bearing > 60 || bearing <= 105) { | |
return "E"; |
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
Started POST "/admin/photos/7/approve" for 199.223.122.34 at 2013-10-29 20:46:18 +0000 | |
2013-10-29T20:46:18.589054+00:00 app[web.1]: Processing by Admin::PhotosController#approve as */* | |
2013-10-29T20:46:18.589054+00:00 app[web.1]: Parameters: {"id"=>"7"} | |
2013-10-29T20:46:18.598598+00:00 app[web.1]: Photo Load (4.2ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = $1 LIMIT 1 [["id", "7"]] | |
2013-10-29T20:46:18.603564+00:00 app[web.1]: (4.6ms) BEGIN | |
2013-10-29T20:46:18.610299+00:00 app[web.1]: Photo Load (3.8ms) SELECT "photos".* FROM "photos" WHERE "photos"."id" = $1 LIMIT 1 [["id", 7]] | |
2013-10-29T20:46:18.613560+00:00 app[web.1]: (2.3ms) UPDATE "photos" SET "approved" = 't', "image" = '0289da71-14cd-46c1-a42c-feff92ac0303/Screen%2520Shot%25202013%252010%252029%2520at%25201.44.20%2520PM.png', "updated_at" = '2013-10-29 20:46:18.610428' WHERE "photos"."id" = 7 |
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
<!-- Form Container Start --> | |
<div class="form-container"> | |
<% if params[:key].nil? %> | |
<%= direct_upload_form_for @uploader, html: {:class => "form"} do |f| %> | |
<p class="field"> | |
<label>Select a photo to upload:</label><br> | |
<%= f.file_field :image %> | |
</p> | |
<p class="field"> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<style type="text/css" media="screen"> | |
.pressed { | |
background: #f00; | |
} | |
.js-dropDown { | |
display: none; |
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
- (void)imagePickerController:(UIImagePickerController *)picker | |
didFinishPickingMediaWithInfo:(NSDictionary *)info { | |
// Hide the image picker. | |
[picker dismissModalViewControllerAnimated:YES]; | |
// Reference the image from the picker. | |
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage]; | |
// Use the size of the image to calculate its aspect ratio. | |
float aspectRatio = image.size.width/image.size.height; |
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
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
// We'll want the controller to become the scrollView's delegate | |
// in order to respond to changes in the content offset position. | |
shelfScrollView.delegate = self; | |
// We'll generate an array of image views to serve as the shelf | |
// background. These shelves will reposition as they scroll out | |
// of the viewport. |
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
background-image: -webkit-radial-gradient(50% 50%, circle closest-side, #2249e1 0%, #1d1e5e 100%); | |
background-image: radial-gradient(50% 50%, circle closest-side, #2249e1 0%, #1d1e5e 100%); |