Skip to content

Instantly share code, notes, and snippets.

View oliviermilla's full-sized avatar

Olivier Milla oliviermilla

View GitHub Profile
@oliviermilla
oliviermilla / get-weather-by-address.html
Created March 3, 2018 17:12 — forked from marchawkins/get-weather-by-address.html
Using the OpenWeatherMap and Google's geolocation APIs to get the current weather for the user-specified location. The user inputs a location, which is geocoded using Google Maps API. Uses the OpenWeatherMap API ((http://openweathermap.org/)) to get the data. Data is returned in JSON format. Most major browsers supported, including IE9, Chrome, …
<div class="row">
<div class="col-md-2 col-sm-2 col-xs-2">
<p><button class="btn btn-primary btn-sm" id="get-weather-btn"><span>Get Weather</span></button></p>
</div><!-- .col -->
<div class="col-md-10 col-sm-10 col-xs-10">
<div class="panel panel-default">
<div class="panel-heading">Weather &amp; Location Response</div>
<div class="panel-body">
<p>Enter Address: <input id="address" type="text" class="form-control"/></p>
<p>Lat/Long: <input id="location-lat-long" type="text" class="form-control"/></p>
@oliviermilla
oliviermilla / CORP.rb
Last active January 22, 2017 22:57 — forked from aruprakshit/CORP.rb
class PurchasePower
def self.base
500
end
def process_request(request)
raise NotImplementedError
end
private
a = []
1.upto(9) do |t|
a.push(t)
end
a = a.permutation.to_a.reverse
nums =[]
for i in 0..a.length
num = a[i].map(&:to_s).join.to_i
end
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
include Pundit
after_action :verify_authorized, unless: :unverified_controller?
def unverified_controller?
class Currency < ActiveRecord::Base
has _many :countries
validates :countries, :presence => true
end
class Country < ActiveRecord::Base
belongs_to :currency
validates :currency, :presence => true
end