Skip to content

Instantly share code, notes, and snippets.

@fguillen
fguillen / BezierCalculator.cs
Last active March 30, 2021 19:23
Bezier Point Calculator for Unity (c#)
// Draw the curve using a bezier curve tool like: https://www.desmos.com/calculator/d1ofwre0fr
// Get p0, p1, p2 and p3 from that tool
using UnityEngine;
using System;
public class BezierCalculator
{
Vector3 p0;
Vector3 p1;
@fguillen
fguillen / Trello_highlight_lists_on_IT_Board.js
Created August 7, 2019 12:08
Trello Board List colorized
// ==UserScript==
// @name Trello highlight lists on IT Board
// @description Highlight certain columns in Trello.
// @include https://trello.com/b/CdaXFAGQ/it-work-in-progress
// @require https://code.jquery.com/jquery-3.4.1.min.js
// @version 0.1
// @copyright 2014, Gareth J M Saunders
// @copyright 2019, Dalia Research GmbH
// ==/UserScript==
@fguillen
fguillen / Trello_highlight_lists_on_IT_Board.js
Created August 7, 2019 12:08
Trello Board List colorized
// ==UserScript==
// @name Trello highlight lists on IT Board
// @description Highlight certain columns in Trello.
// @include https://trello.com/b/CdaXFAGQ/it-work-in-progress
// @require https://code.jquery.com/jquery-3.4.1.min.js
// @version 0.1
// @copyright 2014, Gareth J M Saunders
// @copyright 2019, Dalia Research GmbH
// ==/UserScript==
@fguillen
fguillen / my_wrapper_creator.rb
Last active May 19, 2019 05:55
Providing an `around_action` like functionality in arbitrary Ruby classes
module MyWrapperCreator
def my_method_wrapper(method_name)
original_method = instance_method(method_name)
define_method(method_name) do |*args, &block|
puts "wrapper :: INI"
result = original_method.bind(self).call(*args, &block)
puts "wrapper :: END"
result
drop procedure if exists clone_table;
delimiter $$
create procedure clone_table ()
begin
declare n int;
set n := 0;
while n < 20 do
insert destiny_table select
field_1,
watch -t -n 30 "(date '+%Y-%m-%d %H:%M:%S,' | tr -d '\n'; curl -o /dev/null -s -w %{time_total} http://myweb.com; echo) | tee -a /tmp/my_web.log"
@fguillen
fguillen / beer_time.rb
Last active June 25, 2024 16:39
Announce the beer time
# Simple but necessary script (for Mac) to announce when the beer time is comming
# You can configure your crontab like this
# 0 17 * * 5 ruby $HOME/scripts/beer_time.rb >> /var/log/beer_time.log 2>&1
beer_hour = ARGV[0] || 18
def say(message)
`afplay /System/Library/Sounds/Hero.aiff`
`afplay /System/Library/Sounds/Hero.aiff`
`say "#{message}"`
@fguillen
fguillen / rails_log_query_select_scraper.rb
Created September 8, 2016 21:16
Script to extract, from a Rails log, all the SELECT queries and the duration of each one in a csv format
require "csv"
module Script
def self.run(input_path, output_path)
log = File.read(input_path)
lines_count = log.lines.count
index = 0
File.open(output_path, "w") do |output_file|
@fguillen
fguillen / components.translate-component.js
Last active June 14, 2016 14:02
Helper with ComputeProperty - Component version
import Ember from 'ember';
export default Ember.Component.extend({
});
@fguillen
fguillen / controllers.application.js
Last active June 14, 2016 13:09 — forked from igorstajic/controllers.application.js
Ember Helper and ComputerProperty
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
robotName: '',
robots: Ember.ArrayProxy.create({ content: Ember.A([
{ name: "Mazinger Z" },
{ name: "Lady Electric" }
])}),
actions: {