Skip to content

Instantly share code, notes, and snippets.

View ismasan's full-sized avatar

Ismael Celis ismasan

View GitHub Profile
@ismasan
ismasan / css_grid_draggable.html
Last active May 28, 2024 16:08
Example for reordering CSS grids layout
<html>
<head>
<title>grid</title>
<style>
body {padding: 0; margin: 0;}
.container {
display: grid;
grid-template-rows: 200px repeat(4, 100px);
grid-template-columns: repeat(4, 1fr);
grid-template-areas: "header header header header"
@ismasan
ismasan / variants.rb
Last active July 27, 2017 19:32
Proof of concept for variants with associated headings
require 'ostruct'
require 'set'
require 'rspec'
# rspec variants.rb
#
RSpec.describe "grouping variants by headings, and using variant headings to filter products" do
before do
# Create shop
@shop = Shop.new
@ismasan
ismasan / flux_store_example.js
Created June 13, 2017 22:05
Toy Flux store for React or Preact apps
/* The store
yes yes technically this *does* mutate state, but it's functionally the same
Usage:
let initialState = {
todos: []
}
store = new Store({
fecha operación stock total disponible
2017-05-29T19:16:31 bsale 21 21
2017-05-29T19:16:31 bsale 21 21
2017-05-29T19:34:43 orden 1 20
2017-05-29T19:34:47 bsale 21 21
2017-05-29T19:38:35 orden 1 20
2017-05-29T19:41:53 orden 1 19
2017-05-29T19:45:53 orden 1 18
2017-05-29T19:48:39 orden 1 17
package client
import (
"net/http"
"net/http/httptest"
)
// A *http.Client that talks directly to an http.Handler
// instead of going over the network
// Useful to testing your Go APIs with the same client you provide to your users
# frozen_string_literal: true
source "https://rubygems.org"
gem "rspec"
@ismasan
ismasan / image_backup.rb
Last active May 9, 2017 00:43
Backup all product images in a Bootic shop
# gem install thread
#
# run with:
# SUBDOMAIN=foobar btc runner image_backup.rb
#
require 'open-uri'
require 'fileutils'
require "thread/pool"
require "logger"
require 'uri'
require 'net/http'
require 'json'
# simple SSE client in Ruby
def stream(url, query = nil, parser, &block)
parts = URI.split(url)
uri = URI(url)
if query
uri.query = URI.encode_www_form query
# Gemfile
# gem "bootic_client"
# group :test do
# gem "rack-test"
# end
# spec/support/api_request_helper.rb
# Usage in your API tests
# it "loads the root resource" do
# authorize!(user_id: 1)
@ismasan
ismasan / themes.rb
Last active December 15, 2016 13:40
Backup a Bootic theme using the Bootic CLI
require "fileutils"
require "open-uri"
require "thread"
require "listen"
# dependencies:
# gem install listen
#
# Put this file in ~/btc/themes.rb
# Theme management