Skip to content

Instantly share code, notes, and snippets.

View ccarruitero's full-sized avatar

César Carruitero ccarruitero

View GitHub Profile
class MyCustomEstimator < SolidusEasypost::Estimator
def shipping_rates(package, frontend_only = true)
# your custom logic
end
end
@ccarruitero
ccarruitero / gist:02cce7e55a515d2a2248594f2ea6907d
Created February 12, 2020 00:38
workshopper-adventure trace
> cat test/adventure.test.js
const LegacyAdventure = require('../adventure')
const test = require('tape')
test('LegacyAdventure', (t) => {
const workshopper = new LegacyAdventure('test-workshopper')
t.plan(2)
t.ok(workshopper)
t.equal(workshopper.title, 'test-workshopper')
@ccarruitero
ccarruitero / demo.html
Last active December 3, 2018 17:49
moz-meetup demo
<!doctype html>
<html>
<body>
<template id='moz-meetup'>
<p><slot name='message'>Hello meetup</slot></p>
</template>
<moz-meetup>
<p slot='message'>
another message
</p>
# Updates packages
sudo apt-get update -y
# Installs requirements packages
sudo apt-get install -y curl git-core build-essential postgresql libpq-dev nodejs
# Install rvm
curl -sSL https://rvm.io/mpapis.asc | gpg2 --import
curl -sSL https://get.rvm.io | bash -s stable
echo 'source ~/.rvm/scripts/rvm' >> ~/.bashrc
@ccarruitero
ccarruitero / manifest.json
Created September 17, 2015 16:08
notification extension
{
"manifest_version": 2,
"name": "notification",
"version": "0.1",
"applications": {
"gecko": {
"id": "[email protected]"
}
},
require 'minitest/autorun'
module Flatten
def flatten_arr arr
return error_msg unless arr.is_a? Array
new_arr = []
deep_flat(arr, new_arr)
end
// canvas animation
window.requestAnimationFrame = window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.msRequestAnimationFrame;
var circles = [];
var canvas = document.getElementById('animation');
var ctx = canvas.getContext('2d');
likes = FBLike.uniq.pluck(:name)
require "csv"
CSV.open("file.csv", "wb") do |csv|
csv << ["like_page", "counts"]
likes.each do |like|
like_counts = User.includes(:fb_likes).where(fb_likes: {name: like}).count
csv << [like, like_counts]
end
end
server {
listen 80;
server_name openx.stoptv.pe;
root /var/www/openx;
index index.php;
passenger_enabled off;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
@ccarruitero
ccarruitero / gist:4441060
Created January 3, 2013 05:30
simple firefox os app manifest
{
"name": “MyApp",
"description": “Hello World!",
"launch_path": "/index.html",
"developer": {
"name": "The Gaia Team",
"url": "https://github.com/mozilla-b2g/gaia"
},