Skip to content

Instantly share code, notes, and snippets.

View guilhermechapiewski's full-sized avatar

Guilherme Chapiewski guilhermechapiewski

View GitHub Profile
Ecwid.OnAPILoaded.add(function() {
Ecwid.OnPageLoaded.add(function(page) {
if (page.type == "PRODUCT") {
console.log(
`
Page loaded!
Ecwid store ID is: ${Ecwid.getOwnerId()}
Product ID is: ${page.productId}
`
)
@guilhermechapiewski
guilhermechapiewski / tpb_booking_customizations.js
Last active April 13, 2025 17:26
2peaksbikes.com Ecwid customization script to show our Booxi appointment booking widget properly.
var foundDynElements = false;
var dynElementsInterval = null;
var tpbBookingOpen = false;
const tpbStartInterval = function() {
if ((foundDynElements == false) && (!dynElementsInterval)) {
dynElementsInterval = setInterval(function(){
tpbAttachBookingLink();
}, 500);
}
@guilhermechapiewski
guilhermechapiewski / gist:6066682
Created July 23, 2013 22:21
Creates a "git lg" alias that displays a pretty nicely formatted git log output.
git config --global alias.lg=log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
@guilhermechapiewski
guilhermechapiewski / Makefile
Created April 6, 2011 03:26
Utility scripts to start Titanium Mobile projects from the command line.
PROJECT_ROOT=$(shell pwd)
PROJECT_NAME=SampleApp
run:
@echo "Building with Titanium..."
@mkdir -p ${PROJECT_ROOT}/${PROJECT_NAME}/build/iphone/
@PROJECT_NAME=${PROJECT_NAME} PROJECT_ROOT=${PROJECT_ROOT} DEVICE_TYPE=iphone bash ${PROJECT_ROOT}/bin/titanium.sh
@guilhermechapiewski
guilhermechapiewski / colored_tail.sh
Created February 5, 2011 05:22
"tail -f" a log archive with colored output
#!/bin/bash
# Usage: colored_tail.sh [logfile]
tail -f ${1} | perl -pe 's/^\[DEBUG\].*$/\e[35m$&\e[0m/g;s/^\[INFO\].*$/\e[36m$&\e[0m/g;s/^\[WARN\].*$/\e[33m$&\e[0m/g;s/^\[ERROR\].*$/\e[31m$&\e[0m/g;'
@guilhermechapiewski
guilhermechapiewski / gist:777937
Created January 13, 2011 14:31
Measure website response time through curl
curl -w '\nLookup time:\t%{time_namelookup}\nConnect time:\t%{time_connect}\nPreXfer time:\t%{time_pretransfer}\nStartXfer time:\t%{time_starttransfer}\n\nTotal time:\t%{time_total}\n' -o /dev/null -s 'http://gc.blog.br'
@guilhermechapiewski
guilhermechapiewski / mysql_to_omnigraffle.applescript
Created September 27, 2010 18:23
AppleScript to dump MySQL tables to OmniGraffle Pro.
(*
Copyright (c) 2008, Christian Mittendorf <[email protected]>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this
list ofconditions and the following disclaimer. Redistributions in binary form
must reproduce the above copyright notice, this list of conditions and the
@guilhermechapiewski
guilhermechapiewski / github_toc.js
Created May 6, 2010 00:31
Create "Table of contents" in Github wiki for H1 and H2 items.
$(function () {
var toc = $("<ul>").css("margin-bottom", "20px !important");
$("div.main div.wikistyle h1,h2").each(function() {
var id = $(this).text().replace(/\s+/g, "_").replace(/[^0-9a-zA-Z_.-]/g, "")
$(this).attr("id", id)
if (this.tagName == "H1") {
toc.append(
$("<li>").append($("<b>").append($("<a>").attr("href", "#" + id).text($(this).text())))
)
} else {
@guilhermechapiewski
guilhermechapiewski / github_wiki_toc.js
Created April 26, 2010 15:28 — forked from tekkub/github_wiki_toc.js
Create a "Table of Contents" in your Github wiki
$(function () {
var toc = $("<ul>").css("margin-bottom", "20px !important");
$("div.main div.wikistyle h2").each(function() {
var id = $(this).text().replace(/\s+/g, "_").replace(/[^0-9a-zA-Z_.-]/g, "")
$(this).attr("id", id)
toc.append(
$("<li>").append($("<b>").append($("<a>").attr("href", "#" + id).text($(this).text())))
)
});
$("div.wikistyle").prepend(toc).prepend($("<h2>").text("Table of Contents"));