Skip to content

Instantly share code, notes, and snippets.

View schmuli's full-sized avatar

Schmulik Raskin schmuli

  • CodeValue
  • Israel
View GitHub Profile
@schmuli
schmuli / info.md
Created April 20, 2017 20:59 — forked from M-Zuber/info.md
typescript config/concepts explanations
  • target tells TS what type of JS to generate, for es5 for conversion is required (for example let/const -> var, class -> function + prototype, etc.), whereas es6 can just leave the original code as is (after removing type information).
  • types tells TS about what types exists and what their API is. When using lib you are asking TS to add known core types that it already has definitions for, without having to add those yourself (for example, @types/core-js). When you import you adding more types that TS knows about. Additionally, you can use the types configuration property to add global types.
  • polyfills are required at runtime to ensure that older browsers can use the constructs (such as Promise) that exist natively in modern browsers. At this point, TS is not involved at all.
@schmuli
schmuli / Gulp and Bower Components.md
Last active December 29, 2017 15:44
Minify and Concat all bower components

This is an example gulpFile that can be used to minify and concat all bower components marked as dependencies. Also includes the bower.json and package.json files for the project.

The 'vendors' task will extract all bower components, using main-bower-files, but replaces any files that have a matching .min file that exists. Any unminified files are then minified using Uglify, and then all files are concatenated into a single vendors.js file.

The bower.json deliberately includes the SizzleStats dependency, as this component doesn't include a minified file.

@schmuli
schmuli / example.html
Last active March 19, 2021 18:25
A simple AngularJS service for handling the 'onbeforeunload' event
<!DOCTYPE html>
<html data-ng-app="TestApp">
<head>
<script src="http://code.angularjs.org/1.2.9/angular.js"></script>
<script>
angular.module('TestApp', [])
.factory('beforeUnload', function ($rootScope, $window) {
// Events are broadcast outside the Scope Lifecycle