I hereby claim:
- I am ismasan on github.
- I am ismasan (https://keybase.io/ismasan) on keybase.
- I have a public key whose fingerprint is 3E67 5E59 B46D D332 2669 6883 2AA1 2B6D 5825 B214
To claim this, I am signing this object:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional// "http://www.w3.org/TR/html4/loose.dtd"> | |
<html lang="en"> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> | |
<meta http-equiv="description" content="{{ shop.description }}" /> | |
<!-- Always force latest IE rendering engine & Chrome Frame --> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> | |
<title>{% if resource %}{{ resource.title }}{% endif %}{% if product %}{{ product.title }}{% endif %}{% if template == 'home' %}{{ shop.description }}{% endif %} - {{ shop.name }}</title> | |
{{ 'master.css' | asset_url | stylesheet_tag }} |
{ | |
"class": ["errors", "product"], | |
"links": { | |
"schema": {"href":"..."} | |
}, | |
"properties": { | |
"title": "iphone", | |
"id": null, | |
"slug":"apple-iphone" | |
}, |
# Configura el cliente al inicializar | |
BooticClient.configure do |c| | |
c.client_id = 'xxx' | |
c.client_secret = 'zzz' | |
end | |
# Instancia la estrategia :client_credentials | |
api = BooticClient.client(:client_credentials, scope: 'admin') | |
# La raiz |
<?php | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL,"https://auth.bootic.net/oauth/token"); | |
// Reemplazar client_id:client_secret por credenciales de aplicación | |
curl_setopt($ch, CURLOPT_USERPWD, "client_id:client_secret"); | |
curl_setopt($ch, CURLOPT_POST, 1); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, "grant_type=client_credentials&scope=admin"); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
$server_output = curl_exec ($ch); | |
curl_close ($ch); |
I hereby claim:
To claim this, I am signing this object:
# Here we can't really make sure that each chunk is a line. | |
Net::HTTP.start(uri.host, uri.port, use_ssl:true) do |http| | |
request = Net::HTTP::Get.new uri | |
# request.basic_auth 'user', 'pwd' | |
http.request request do |response| | |
response.read_body do |chunk| | |
CSV.parse(chunk).each do |line| | |
puts line | |
puts 'END' | |
end |
# http://stackoverflow.com/questions/6005139/ruby-1-9-2-read-and-parse-a-remote-csv | |
require 'rubygems' | |
require 'open-uri' | |
require 'csv' | |
def read(url) | |
CSV.new(open(url), :headers => :first_row).each do |line| | |
puts line | |
puts line[0] | |
puts line['FEB11'] |
# Create ActiveRecord schemas on the fly for AR extensions testing | |
# | |
ActiveRecord::Base.establish_connection( | |
:adapter=>'sqlite3', | |
:dbfile=> File.join(File.dirname(__FILE__),'..','spec','db','test.db') | |
) | |
# define a migration | |
class TestSchema < ActiveRecord::Migration | |
def self.up | |
create_table :items do |t| |
module BlahPlugin | |
VERSION = '1.0.0' | |
class << self | |
# add plugin to AR only if it hasn't been included before, | |
# which may cause stack-level-too-deep errors if you're aliasing methods | |
# | |
def enable_activerecord | |
return if ActiveRecord::Base.respond_to? :acts_as_blah | |
ActiveRecord::Base.extend BlahPlugin::Macro |
# we want /posts, /posts/published, /posts/drafts, etc. without too much duplication | |
# model | |
class Post < ActiveRecord::Base | |
named_scope :published, lambda {{:conditions => ...}} | |
named_scope :draft, lambda {{:conditions => ...}} | |
named_scope :expired, lambda {{:conditions => ...}} | |
named_scope :upcoming, lambda {{:conditions => ...}} | |
end | |