Skip to content

Instantly share code, notes, and snippets.

View Daniel-Wiedemann's full-sized avatar

MEDIATRASH Daniel-Wiedemann

View GitHub Profile
Date
Basic date: Format: DD.MM.YYYY
(0[1-9]|1[0-9]|2[0-9]|3[01]).(0[1-9]|1[012]).[0-9]{4}
@Daniel-Wiedemann
Daniel-Wiedemann / local_to_world.js
Last active August 29, 2015 14:07
Local to World
var parent = new THREE.Object3d();
var child = new THREE.Object3d();
parent.add(child);
parent.position.y = 100;
child.position.y = 200;
// we get 200, because child.position returns us the local position
console.log( child.position.y );
// we get 300, because child.localToWorld(new THREE.Vector3()) returns us the global position
@Daniel-Wiedemann
Daniel-Wiedemann / compute_boundingbox_group_objects.js
Created September 28, 2014 21:04
Compute Boundingbox from a group of Objects
/**
* Calculates the bounding box of grouped 3d Objects, with Objects that contains geometries
* @param {Object3d} objectgroup A Object3d that contains other Object3d objects like Mesh.
* @return {Object} Returns a Object with two parameter min{THREE.Vector3} and max{THREE.Vector3}
*/
function computeBoundingBoxGroupObjects(objectgroup){
var minX = 0, minY = 0, minZ = 0, maxX = 0, maxY = 0, maxZ = 0;
function getBox(item){
if(item.geometry){
@Daniel-Wiedemann
Daniel-Wiedemann / negative_loop.js
Last active August 29, 2015 14:07
Decrement for Loop (or. negative for loop)
for(var i = array.length; i--;) {
// do something
}
// =====================================
// example
var letters = ['a','b','c','d','e','f'];
for(var i = arr.length; i--;){
console.log(arr[i]);
}
@Daniel-Wiedemann
Daniel-Wiedemann / radians_degrees.txt
Last active August 29, 2015 14:07
Radians - Degrees
radians = degrees * Math.PI / 180
degrees = radians * 180 / Math.PI
0 degrees = 0 radians
1 degrees = pi / 180 radians oder 0,0174532925199433 radians (ca.)
45 degrees = pi / 4 radians oder 0,7853981633974483 radians (ca.)
60 degrees = pi / 3 radians oder 1,047197551196598 radians (ca.)
90 degrees = pi / 2 radians
180 degrees = pi radians
270 degrees = 3 pi / 2
@Daniel-Wiedemann
Daniel-Wiedemann / node-gyp
Last active August 29, 2015 14:10
solve error by installing node-gyp
Update(29.03.2015): First try the steps on this website https://github.com/TooTallNate/node-gyp/wiki/Updating-npm's-bundled-node-gyp
If the installation of node-gyp causes errors,
try following.
(a version of microsoft visual studio express 2012 or 2013
has to be installed first)
npm install -g node-gyp --msvs_version=2012
@Daniel-Wiedemann
Daniel-Wiedemann / modul_discription.js
Created December 18, 2014 12:13
JavaScript Modul definition
if (typeof define === 'function' && define.amd) {
define(['jquery'], wunderBarFactory);
} else if (typeof exports === 'object') {
module.exports = wunderBarFactory(require('jquery'));
} else {
window.WunderBar = wunderBarFactory(jQuery);
}
$('#repeaterContainer .item.active')[0].classList.toString().split(' ').filter(getMonth).toString()
var getMonth = function(element){
return element.indexOf('month') >= 0;
}
@Daniel-Wiedemann
Daniel-Wiedemann / echo command
Last active August 29, 2015 14:18
Create empty text file
With echo command it is possible to create an empty text file.
E.g.
C:\ echo > test.txt
or
C:\ echo > app.js
Add text
C:\ echo Mein Text > text.txt
@Daniel-Wiedemann
Daniel-Wiedemann / Get Pins
Last active August 29, 2015 14:19
Pinterest API - Abfrage der Pins
GET Abfrage:
https://api.pinterest.com/v3/pidgets/boards/<USER_NAME>/<BOARD>/pins/
https://api.pinterest.com/v3/pidgets/boards/mediatrash/nice-webpages/pins/
Links dazu:
http://techslides.com/using-the-pinterest-api
http://zoerooney.com/blog/tutorials/display-a-pinterest-feed-almost-anywhere-via-rss/
http://pinterestapi.co.uk/
Rückgabe ist ein JSON