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
| navigator.geolocation.getCurrentPosition(function(position){ alert(position.coords.latitude + ", " + position.coords.longitude) }); |
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
| var myPosition = new Array(); | |
| $(document).ready(function() { | |
| navigator.geolocation.getCurrentPosition( | |
| onSuccess, | |
| onError, { | |
| enableHighAccuracy: true, | |
| timeout: 20000, | |
| maximumAge: 120000 | |
| } |
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
| category = Category.create(name: "A") | |
| ["produkt 1", "produkt 2"].each do |name| | |
| product = category.products.build(name: name) | |
| product.save! | |
| 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
| metal_price = case product.category.kind | |
| when "gold_coin", "gold_bar" then gold_price | |
| when "silver_coin", "silver_bar" then silver_price | |
| 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
| #!/usr/bin/env ruby | |
| require 'fileutils' | |
| class CameraTool | |
| CAMERA_UPLOADS_LOCAL = "/Users/kelso/Dropbox/Camera Uploads/" | |
| CAMERA_PHOTOS_ARCHIVE_LOCAL = "/Users/kelso/Documents/Camera Uploads/Photos/" | |
| CAMERA_VIDEOS_ARCHIVE_LOCAL = "/Users/kelso/Documents/Camera Uploads/Videos/" | |
| CAMERA_PHOTOS_ARCHIVE_EXTERNAL = "/Volumes/My Book/Camera/Photos/" |
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
| has_many :relationships | |
| has_many :people, through: :relationships |
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 | |
| # Prevent CSRF attacks by raising an exception. | |
| # For APIs, you may want to use :null_session instead. | |
| protect_from_forgery with: :exception | |
| before_action :set_locale | |
| before_action :set_cart | |
| def set_cart | |
| @cart = ShoppingCart.new(session) |
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
| $.ajax( "example.php" ) | |
| .done(function() { | |
| alert( "success, juppii" ); | |
| }) | |
| .fail(function() { | |
| alert( "error, sakra" ); | |
| }) | |
| .always(function() { | |
| alert( "complete" ); | |
| }); |
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
| $ vagrant up development | |
| [development] VM already created. Booting if it's not already running... | |
| [development] Clearing any previously set forwarded ports... | |
| [development] Forwarding ports... | |
| [development] -- 22 => 2222 (adapter 1) | |
| [development] -- 3000 => 61000 (adapter 1) | |
| [development] Creating shared folders metadata... | |
| [development] Clearing any previously set network interfaces... | |
| [development] Preparing network interfaces based on configuration... | |
| [development] Running any VM customizations... |