Skip to content

Instantly share code, notes, and snippets.

@cie
cie / gist:276f7450611eead1425cbed8e5a12d71
Last active June 4, 2020 10:48
Processing calculate inverse of screenX/screenY (WIP, not working perfectly)
void mouseDragged() {
if (mouseButton == RIGHT) {
float z = screenZ(k.x,k.y,k.z);
println(z);
PMatrix3D proj = ((PGraphics3D) this.getGraphics()).projection;
PMatrix3D transform = ((PGraphics3D) this.getGraphics()).modelview;
PMatrix3D a = transform.get();
PMatrix3D b = proj.get();
a.invert();
[user]
name = Bernát Kalló
email = [email protected]
[core]
askpass = /bin/echo
editor = vim
whitespace = off
pager = view -
[advice]
statusuoption = false
@cie
cie / gist:8604271
Created January 24, 2014 19:27
A colored indicator of the git tree status
git_ps1() {
GIT_PS1="$(__git_ps1)"
if [ "$GIT_PS1" ]; then
GIT_STATUS=$(git status --porcelain)
# if there are modified files
if echo "$GIT_PS1" | grep 'CONFLICT' > /dev/null; then
GIT_COLOR=31
elif echo "$GIT_STATUS" | grep '^.M' > /dev/null ; then
GIT_COLOR=35
# if there are unknown files
@cie
cie / stuff.pde
Last active December 31, 2015 11:49
Stuff - Lightweight scene graph for Processing
/*
Sometimes you don't need a complex framework for your Processing sketch.
Just some stuff you can draw click and drag.
1. Copy-paste this code to a new tab in your sketch, and create subclasses of Stuff.
2. Add this code to your sketch:
class MainStuff extends Stuff {
void setup() {
}
@cie
cie / dabblet.css
Created October 23, 2013 10:29
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
body {
font-family: "Calibri", sans;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
@cie
cie / irails.rb
Created August 1, 2012 16:05
IRails - run Rails server and generate from the Rails console
# IRails - Run rails server and generator subcommands from the Rails console
#
# This is a solution based on http://blockgiven.tumblr.com/post/5161067729/rails-server
# Can be used to run rails server, rails generate from the Rails console thus
# speeding up Rails server startup to ~ 1 second.
#
# Usage:
# Rails.server to start the rails server
# Rails.generate to list generators
# Rails.generate "model", "user" to use a generator
@cie
cie / igem.rb
Created July 24, 2012 14:40
IGem - run gem executables with forking, thus save the loading time. Can be used to speed up Rails generate, Rails server startup or Rake from minutes to seconds.
=begin
IGem - run gem executables with forking, thus save the loading time. Can be used to speed up Rails generate, Rails server startup or Rake from minutes to seconds.
Usage:
$ rails console
>> IGem.run "rake db:migrate"
>> IGem.run "rails server", wait: false
>> IGem.run "rake --tasks", fork: false