Skip to content

Instantly share code, notes, and snippets.

Rafael Belvederese blvz

Block or report user

Report or block blvz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@blvz
blvz / bluetooth-restart.sh
Last active Jul 12, 2019 — forked from thiagoghisi/bluetooth-restart.sh
Script for Mac OSX to Restart Bluetooth service & Reconnect all recently paired devices
View bluetooth-restart.sh
#!/usr/bin/env zsh
max_tries=3
devices=()
devices_ids=()
echo 'restarting bluetooth service.'
blueutil -p 0 && sleep 1 && blueutil -p 1
echo 'waiting bluetooth service to be restored.'
@blvz
blvz / gh-deploy-clone.sh
Last active Oct 15, 2019
Creates a deploy key and clones the repository.
View gh-deploy-clone.sh
#!/usr/bin/env bash
read -r -d '' usage << EOM
Usage:
gh-deploy-clone user/repo [ENVIRONMENT]
EOM
[ -z "$1" ] && echo && echo "$usage" && echo && exit 1
@blvz
blvz / Create Background.jsfl
Last active Jan 8, 2016
Creates a primitive rectangle for the current selection. Useful when adding background for text boxes.
View Create Background.jsfl
// by @blvz
var padding = 10
, radius = 10;
(function(doc) {
var bounds, rect, newRect, fill, stroke
, tml = doc.getTimeline()
, sel = doc.selection.concat()
, rs = sel.filter(function(e) { return e.elementType == 'shape'
View QLTextFiles.sh
#!/bin/bash
curl -O https://github.com/whomwah/qlstephen/releases/download/1.4.2/QLStephen.qlgenerator.1.4.2.zip
unzip QLStephen.qlgenerator.1.4.2.zip
echo "Please enter your password when asked (the one sudo asks you for usuqlly). It's needed to copy some files to /Library/QuickLook"
sudo mv -f QLStephen.qlgenerator /Library/QuickLook
rm QLStephen.qlgenerator.1.4.2.zip
qlmanage -r
View spreadsheet_column_utils.rb
# converting back and forth between (excel) spreadsheets column name / alpha and column number / index
# by Rafael Belvederese, inpired by this thread:
# http://stackoverflow.com/questions/22708/how-do-i-find-the-excel-column-name-that-corresponds-to-a-given-integer
def alpha_to_index(alpha)
alpha.upcase!
if alpha.length == 1
return alpha.bytes.to_a[0] - 65
elsif alpha.length != 0
return ((alpha_to_index(alpha[0]) + 1) * (26 ** (alpha.length - 1))) + alpha_to_index(alpha[1..-1])
View DragScroller.as
/*
This is just the DragScrollingCanvas from FlexLib, with a small mod to work
with Spark Scroller. :)
Copyright (c) 2007 FlexLib Contributors. See:
http://code.google.com/p/flexlib/wiki/ProjectContributors
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
@blvz
blvz / Sample.as
Created Jul 21, 2010
creating large bitmaps as tiles
View Sample.as
package {
import flash.display.StageScaleMode;
import flash.display.DisplayObject;
import flash.display.Loader;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.events.Event;
import flash.events.ProgressEvent;
import flash.net.URLRequest;
import flash.text.TextField;
You can’t perform that action at this time.