Skip to content

Instantly share code, notes, and snippets.

View juanRabaa's full-sized avatar

Juan Cruz Rabaglia juanRabaa

  • Genosha
  • Buenos Aires, Argentina
View GitHub Profile
@duhaime
duhaime / body2mesh.js
Last active February 17, 2024 22:44
Convert a Cannon.js body to a THREE.js mesh
function body2mesh(body, wireframe) {
var wireframe = wireframe || true;
var obj = new THREE.Object3D();
for (var l = 0; l < body.shapes.length; l++) {
var shape = body.shapes[l];
var mesh;
switch(shape.type){
@Strae
Strae / aframe-obj-opacity.md
Last active April 22, 2020 09:23
Aframe opacity on 3D objects

@source: https://stackoverflow.com/questions/43914818/alpha-animation-in-aframe-for-a-object-model

The built-in material component primarily works with primitives, so material="opacity: 0.5" and similarly opacity="0.5" will not work here. You'll need to modify the THREE.js materials created by your model, using a custom component. Example:

AFRAME.registerComponent('model-opacity', {
  schema: {default: 1.0},
  init: function () {
    this.el.addEventListener('model-loaded', this.update.bind(this));
  },
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@m1r0
m1r0 / wp_insert_attachment_from_url.php
Last active April 11, 2024 12:33
WP: Insert attachment from URL
<?php
/**
* Insert an attachment from a URL address.
*
* @param string $url The URL address.
* @param int|null $parent_post_id The parent post ID (Optional).
* @return int|false The attachment ID on success. False on failure.
*/
function wp_insert_attachment_from_url( $url, $parent_post_id = null ) {
@marcoalexpinheiro
marcoalexpinheiro / CSS Rendered at GPU
Created June 11, 2013 14:41
Force CSS to be rendered in GPU
/* we apply a 3d transform just to improve rendering */
-webkit-transform:translateZ(0.1px);
-moz-transform:translateZ(0.1px);
-o-transform:translateZ(0.1px);
-ms-transform:translateZ(0.1px);
transform:translateZ(0.1px);
@sudar
sudar / wp-increase-timeout.php
Created February 13, 2013 15:54
Increase the curl timeout in WordPress
<?php
Copied from http://fatlabmusic.com/blog/2009/08/12/how-to-fix-wp-http-error-name-lookup-timed-out/
//adjustments to wp-includes/http.php timeout values to workaround slow server responses
add_filter('http_request_args', 'bal_http_request_args', 100, 1);
function bal_http_request_args($r) //called on line 237
{
$r['timeout'] = 15;
return $r;
}