Skip to content

Instantly share code, notes, and snippets.

View Daniel-Wiedemann's full-sized avatar

MEDIATRASH Daniel-Wiedemann

View GitHub Profile
@Daniel-Wiedemann
Daniel-Wiedemann / pad
Created August 14, 2018 09:27
Pad a number with leading zero in JavaScript
module.exports.pad = (paramNumber) => {
paramNumber < 10 && paramNumber > -1 ? '0' + paramNumber : paramNumber;
};
@Daniel-Wiedemann
Daniel-Wiedemann / speed_up_browserSync_watch.js
Created August 19, 2016 07:59
Speed up browserSync with watcher after SASS compiling
// If the browserreload with browserSync and watch after SASS compiling is to slow,
// following solutions could help.
// Use one or more of the following options
// Options:
// spawn: false
// interrupt: true
// persistent: true
// interval: 5007
grunt.initConfig({
@Daniel-Wiedemann
Daniel-Wiedemann / trimDoubleChars.js
Created September 24, 2015 19:32
Remove double Charaters (Beware of the spaces!!!)
function removeDoubleChars(){
var input = document.getElementById('inputText').value,
output = document.getElementById('outputText'),
chars = [];
for(var i = 0; i < input.length; i++){
if(chars.indexOf(input[i]) === -1) chars.push(input[i]);
}
chars.sort();
output.value = chars.join('');
};
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
@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
@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
$('#repeaterContainer .item.active')[0].classList.toString().split(' ').filter(getMonth).toString()
var getMonth = function(element){
return element.indexOf('month') >= 0;
}
@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);
}
@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 / 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