Skip to content

Instantly share code, notes, and snippets.

View ismasan's full-sized avatar

Ismael Celis ismasan

View GitHub Profile
<?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);
# Cache Headers
# Middleware for configuring HTTP cache policy headers in Rack based web applications.
# Apply cache headers to HTTP responses corresponding to requests that match defined
# URI patterns.
#
# Example usage:
#
# use Rack::CacheHeaders
#
# Rack::CacheHeaders.configure do |cache|
@ismasan
ismasan / Gemfile
Created March 17, 2010 17:04 — forked from rmanalan/.gems
gem 'rack-contrib', :git => 'git://github.com/rack/rack-contrib.git'
gem 'rack-rewrite'
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
# - a browser with WebSocket support
#
# Usage:
# ruby redis_pubsub_demo.rb
#
@ismasan
ismasan / async_fibers.rb
Created November 17, 2011 15:00 — forked from markevans/async_fibers.rb
Async server example with Fibers
require 'fiber'
module Stuff
class << self
def system_call_1
f = Fiber.current
EM.system 'delayedEcho dogs' do |result, status|
f.resume result
end
@ismasan
ismasan / gist:1582736
Created January 9, 2012 12:28 — forked from newbamboo/gist:1261956
Linode Ubuntu 10.04 (Lucid) with passenger & nginx for rails hosting
#################################################################
# #
# A guide to setting up a linode Ubuntu VPS for #
# Ruby on Rails hosting with nginx & passenger #
# #
# Compiled by Chris Toomey [ctoomey.com] on Sept. 9 2011 #
# #
#################################################################
# Start with base 10.04 image. Setup the DNS for any domains you
@ismasan
ismasan / config.ru
Created February 29, 2012 17:34
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
# Run this file with `RAILS_ENV=production rackup -p 3000 -s thin`
# Be sure to have rails and thin installed.
require "rubygems"
require "rails"
# Let's load only action controller. If you want
# to use active record, just require it as well.
require "action_controller/railtie"
class MyApp < Rails::Application
@ismasan
ismasan / crop.js
Created November 14, 2012 20:32 — forked from arian/crop.js
Cropping images with nodejs streams and imagemagick
var spawn = require('child_process').spawn;
var Stream = require('stream');
/**
* crops and resizes images to our desired size
* @param {Stream} streamIn in stream containing the raw image
* @return {Stream}
*/
exports.cropImage = function(streamIn){
<!-- Formulario y botón "agregar al carro" en plantilla product.html.
Los data-attributes son necesarios para la API Ajax del carrito (opcional) -->
<form class="add_to_cart" action="{{ add_to_cart_url }}" method="post" data-bootic-cart-add="add" data-bootic-productId="{{ product.id }}">
<!-- si hay más de 1 variante, muéstralas en una lista -->
{% if product.variants_count > 1 %}
<h4>{{ 'activerecord.models.variant' | t }}</h4>
<ul class="variants">
<!-- primero las variantes disponibles -->
{% for variant in product.available_variants %}
<li class="bootic_variant available {% cycle 'odd', 'even' %} av-variant-{{ forloop.index }}">
@ismasan
ismasan / Procfile
Created February 11, 2013 16:30 — forked from toolmantim/Procfile
app_1: foreman start --root app_1 --port 3000 --env app_1/.env
app_2: foreman start --root app_2 --port 3100 --env app_2/.env
app_3: foreman start --root app_3 --port 3200 --env app_3/.env