Skip to content

Instantly share code, notes, and snippets.

View tenadavila's full-sized avatar

José Tena tenadavila

View GitHub Profile
public void menu(View v) {
LayoutInflater inflater = this.getLayoutInflater();
View view = inflater.inflate(R.layout.menu, null);
Dialog mDialog = new Dialog(this,
android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
mDialog.setContentView(view);
mDialog.getWindow().setLayout(500, 600);
mDialog.show();
//The shader that renders the Bitmap
BitmapShader fillBMPshader;
//Initialize the BitmapShader with the Bitmap object and set the texture tile mode
fillBMPshader = new BitmapShader(color, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT);
//Initialize the fillPaint object
pCell = new Paint();
pCell.setStyle(Paint.Style.FILL);
//Assign the 'fillBMPshader' to this paint
pCell.setShader(fillBMPshader);
@tenadavila
tenadavila / gist:5841385
Created June 22, 2013 16:02
adb screenshot
adb shell /system/bin/screencap -p /sdcard/screenshot.png
adb pull /sdcard/screenshot.png screenshot.png
public class Dog {
public static void main(String[] args) {
Dog aDog = new Dog("Max");
foo(aDog);
aDog.name.equals("Max"); // true
}
public static void foo(Dog d) {
d.name.equals("Max"); // true
d = new Dog("Fifi");
d.name.equals("Fifi"); // true
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:facebook="http://www.mulesoft.org/schema/mule/facebook" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/facebook http://www.mulesoft.org/schema/mule/facebook/current/mule-faceboo
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@tenadavila
tenadavila / gist:d6e8904e99170cdbb27de2c849d86c78
Created February 25, 2021 18:57
Sketchup -> Ruby transform model to tables
mod = Sketchup.active_model
ent = mod.active_entities
sel = mod.selection
SKETCHUP_CONSOLE.clear
org = Geom::Point3d.new(); spc = 10.cm
cdn = ent.grep(Sketchup::ComponentInstance).map{|ci|ci.definition.name}.uniq.sort
cdn.each{|n|
cis = ent.grep(Sketchup::ComponentInstance).each{|ci|
next unless ci.definition.name==n
ci.transform! ci.transformation.inverse