Skip to content

Instantly share code, notes, and snippets.

View dgieselaar's full-sized avatar

Dario Gieselaar dgieselaar

View GitHub Profile
@dgieselaar
dgieselaar / gist:748595
Created December 20, 2010 16:32
Testing for possible FP 10.1 multiplication bug
// should be: 94.8
// results in 94.80000000000001 in WIN 10,1,53,64 debug
var value:Number = 9.48 * 10;
trace("result: " + value + " (using : " + Capabilities.version + " " + (Capabilities.isDebugger ? "debug" : "release") +")");
javascript:(function ( ) { var host = 'http://shareit.fm',html = '/bookmarks/#' + encodeURIComponent(window.location.href); window.open(host + html, '_blank');})();
/*global angular,_*/
(function ( ) {
angular.module('Zaaksysteem')
.directive('zsCrudTableAutoSize', [ '$window', '$timeout', function ( $window, $timeout ) {
return {
link: function ( scope, element/*, attrs*/ ) {
function setAutoWidth ( ) {
/*global module*/
var lrserver = require('tiny-lr')();
module.exports = function ( grunt ) {
grunt.initConfig({
watch: {
sass: {
files: [ '**/*.scss' ],
/*global angular*/
(function ( ) {
/* This interceptor allows you to target partials
within lazy loaded html files. Usage:
index.html:
<div>
data-ng-include="/partials/components.html#single-component>
</div>

App logic and structure expressed in HTML, which is enchanting for beginners (Look’ma no JS, magic!), but terrible for real development. We are developers, we write and debug code. But Angular is HTML parser. I really don’t want to debug any string based parser instead of my code. HTML should be just a projection of app state, not a source of truth!

Te veel logica in je template zetten is inderdaad geen goed idee. Wat dat betreft is Angular zijn expression parser misschien te vergevend. Assignments in je click handlers in de HTML zetten (bijv ng-click="state='open'") of iets dergelijks is een slecht idee en zou eigenlijk niet ondersteund moeten worden.

Dat gezegd hebbende, ik heb bij mijn huidige werkgever een brok javascript geërfd waarbij functionaliteit op basis van aanwezige classes wordt toegevoegd. Dit is verschrikkelijk om te debuggen. Bij Angular kijk je welke directives (attributes) op de button zitten waar je op klikt, of het element wat getoond wordt, en je hebt binnen no time het verantwoordel

<div class="scrollable" coen-scroll>
<ul class="actual-menu" data-ng-show="coenScroll.getScroll()>100">
</ul>
</div>
<script type="text/javascript">
angular.module('coen')
@IF EXIST "%~dp0\node.exe" (
"%~dp0\node.exe" "%~dp0\..\bower\bin\bower" %*
) ELSE (
@SETLOCAL
@SET PATHEXT=%PATHEXT:;.JS;=;%
node "%~dp0\..\bower\bin\bower" %*
)
@dgieselaar
dgieselaar / cmdwrap
Last active August 29, 2015 14:07
If you run `npm install` on Windows, the build script creates .cmd wrappers for the package scripts in `node_modules/.bin`. This is to ensure commands like "bower install" works on Windows in your `scripts`. However, if you run `npm install` on a Unix machine, those .cmd files won't be added, which causes your scripts to fail on a Windows machin…
for f in $(find './node_modules/.bin' -maxdepth 1 ! -name "*.*"); do
name=$(basename $f);
cp cmdwrap.tpl "$f.cmd";
sed -i "s,PACKAGE_NAME,$name,g" $f.cmd;
done
function js ( ) {
var stream = gulp.src([ 'src/**/_*.js', 'src/**/*.js' ] )
.pipe(sourcemaps.init())
.pipe(cached('js'))
.pipe(plumber())
.pipe(babel( {
blacklist: [ "useStrict" ],
babelHelpers: {
outputType: 'var'
}