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 / angular-yeoman
Created November 28, 2013 01:24
Sometimes when you install angular with yeoman you get some issues. Here are a few solutions. From https://github.com/gruntjs/grunt-contrib-imagemin/issues/109
You don't have to add "jpegtran-bin": "0.2.0" to package.json
Remove node_modules folder if necessary
Do npm install [email protected]
Do npm install
It worked for me.
@Daniel-Wiedemann
Daniel-Wiedemann / _mixins.scss
Created December 6, 2013 16:18
MIXINS - Compass (SCSS, SASS)
_
@Daniel-Wiedemann
Daniel-Wiedemann / setup-sublime-text
Last active January 2, 2016 11:29
Setup Sublime Text 2
Syntax for Sublime Text
LESS
https://github.com/danro/LESS-sublime
-------------------------------------------------------------------------------------
SASS
https://sublime.wbond.net/packages/Sass
-------------------------------------------------------------------------------------
@Daniel-Wiedemann
Daniel-Wiedemann / get-value-label-from-option.js
Created January 23, 2014 17:01
Get value and label from select HTMLElement
// <select id="test1">
// <option value="1">a</option>
// <option value="2">b</option>
// <option value="3">c</option>
// </select>
document.getElementById('test1').addEventListener('change', function(event){
var that = this; // or event.target
// if option has no value attribute, the event value returns the label
console.log('value: ' + that.value + ' | label: ' + that.selectedOptions[0].label);
@Daniel-Wiedemann
Daniel-Wiedemann / Large numbers erroneously rounded
Created February 7, 2014 16:33
Large numbers erroneously rounded in Javascript // AJAX, JSON response/request
Erklärung zu dem Problem:
http://stackoverflow.com/questions/1379934/large-numbers-erroneously-rounded-in-javascript
http://www.2ality.com/2012/04/number-encoding.html
What you're seeing here is actually the effect of two roundings. Numbers in ECMAScript are internally represented double-precision floating-point. When id is set to 714341252076979033 (0x9e9d9958274c359 in hex), it actually is assigned the nearest representable double-precision value, which is 714341252076979072 (0x9e9d9958274c380). When you print out the value, it is being rounded to 15 significant decimal digits, which gives 14341252076979100.
JavaScript uses double precision floating point values, ie a total precision of 53 bits, but you need
@Daniel-Wiedemann
Daniel-Wiedemann / Environment Variables.xml
Created February 7, 2014 18:15
Sublime Text 2 Environment Variables
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Globals</string>
<key>scope</key>
<string></string>
<key>settings</key>
<dict>
@Daniel-Wiedemann
Daniel-Wiedemann / skeleton-namespace.xml
Created February 7, 2014 18:17
Sublime Text 2 Snippet Skeleton namespaces
<snippet>
<content><![CDATA[
/**
* name: $TM_FULLNAME
* email: $TM_EMAIL
* filename: $TM_FILENAME
* @type {{}}
*/
(function( ${1:namespace}, \$, undefined ) {
@Daniel-Wiedemann
Daniel-Wiedemann / Evaluation MV* Frameforks
Created February 9, 2014 19:53
Evaluation of AngularJS, EmberJS, BackboneJS + MarionetteJS
http://blog.binarymist.net/2013/12/28/evaluation-of-angularjs-emberjs-backbonejs-marionettejs/
https://egghead.io/lessons
@Daniel-Wiedemann
Daniel-Wiedemann / Sublime Alignment
Created March 10, 2014 09:14
Sublime Text 2 Packages
http://wbond.net/sublime_packages/alignment#Package_Settings
Usage
Make a multi-line selection, or multiple selections
Press ctrl+alt+a on Windows and Linux, or cmd+ctrl+a on OS X
When using with a multi-line selection, the lines will be indented consistently first. If the selected lines are consistently indented, the first = on each line will be aligned. The character to align to for mid-line alignment can be configured via the settings.
Example:
befor:
To add a prefix to filenames in an folder.
1. open the command line window
2. go into the folder where are the files to add the "_prefix"
3. FOR /r "." %a in (*.*) DO REN "%~a" "prefix%~nxa"
You can also define which files should get prefixed
eg. only .txt files
FOR /r "." %a in (*.txt) DO REN "%~a" "prefix%~nxa"