Skip to content

Instantly share code, notes, and snippets.

Igor Minar IgorMinar

Block or report user

Report or block IgorMinar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@IgorMinar
IgorMinar / _purify.md
Last active Mar 30, 2017
purify.js with cli and webpack plugin - simple and super-hackish Uglify pre-optimizer
View _purify.md

This is a super-hacky tool that processes JavaScript bundless before they are fed to Uglify.

Purify adds @__PURE__ annotation in front of all IIFE's that represent ES classes downleveled by TypeScript.

This annotation then enables Uglify 2.8+ to safely recognize if the class is not used and remove it.

You can use it webpack-plugin or cli.

Angular developers will need the bundle to be also processed by alxhub/ngo before the full effect can be seen.

@IgorMinar
IgorMinar / angular-cli-vendor-sourcemaps.patch
Created Mar 22, 2017
Patch @angular/cli@1.0.x to enable vendor source maps
View angular-cli-vendor-sourcemaps.patch
--- common.js.orig 2017-03-22 10:53:54.000000000 -0700
+++ common.js 2017-03-22 10:54:37.000000000 -0700
@@ -69,7 +69,7 @@
},
module: {
rules: [
- { enforce: 'pre', test: /\.js$/, loader: 'source-map-loader', exclude: [nodeModules] },
+ { enforce: 'pre', test: /\.js$/, loader: 'source-map-loader'},
{ test: /\.json$/, loader: 'json-loader' },
{ test: /\.html$/, loader: 'raw-loader' },
View angular-ios9-uiwebview.patch.js
/**
* ================== angular-ios9-uiwebview.patch.js v1.1.1 ==================
*
* This patch works around iOS9 UIWebView regression that causes infinite digest
* errors in Angular.
*
* The patch can be applied to Angular 1.2.0 – 1.4.5. Newer versions of Angular
* have the workaround baked in.
*
* To apply this patch load/bundle this file with your application and add a
@IgorMinar
IgorMinar / angular-bc.js
Created Apr 2, 2012 — forked from vojtajina/angular-bc.js
Angular: BC module for scope/controller separation
View angular-bc.js
/**
* @license AngularJS
* (c) 2010-2012 AngularJS http://angularjs.org
* License: MIT
*/
/**
* Backward compatibility module for AngularJS
* @author Vojta Jina <vojta.jina@gmail.com>
*
View scratch5
/// bootstrap code
var myApp = angular.module('myApp', []);
//// resource def
var pops;
pops = function($resource) {
return $resource('/pops/:id', {}, {
View gist:1485219
describe('html', function() {
- it('should replace element with template', inject(
+ iit('should replace element with template', inject(
function($compileProvider){
$compileProvider.directive('replace', valueFn({
- html: '<div class="myWidget" new="newAttr"><<CONTENT>></div>',
+ html: '<div class="myWidget" new="newAttr">{{foo}} <<CONTENT>></div>',
compile: function(element, attr){
attr.$set('compile', true);
@IgorMinar
IgorMinar / gist:1474608
Created Dec 14, 2011
Misko's antiminification
View gist:1474608
case 8: /* Comment */
match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);
- if (match &&
- (directive = getDirective(nName = camelCase(match[1])))) {
- attrs[nName] = trim(match[2]);
- directives.push(directive);
+ if (match) {
+ nName = camelCase(match[1]);
+ directive = getDirective(nName);
+ if (directive) {
View angular-ctrl-export-proposal.js
function($ctrlProvider) {
$ctrlProvider.provide('FooCtrl', FooCtrl);
var export = $ctrlProvider.export;
function FooCtrl($http, $scope) {
this.scope_ = $scope;
this.http_ = $http;
}
FooCtrl.prototype.publicMethodA = export(function(){
View gist:1293065
<html>
<head>
<script src="http://code.angularjs.org/angular-0.10.3.js" ng:autobind></script>
<script>
function MyCntrl() {
this.list_of_items = ['this', 'that', 'the other'];
this.foo = {choice:'that'};
}
MyCntrl.prototype = {
loadData: function(){
View gist:1030586
<html>
<head>
<script src="http://code.angularjs.org/angular-0.9.16.min.js" ng:autobind></script>
<script>
function CalculatorController() {
this.integer = /^\d+$/;
this.fraction = /^\d+\.*\d*$/;
this.difficulty = 877226;
this.hashtime = function() { return Math.round(this.difficulty * Math.pow(2, 32) / (this.hashrate * 1000))/(3600*24) };
this.opex = function() { return this.time*24 * this.electricity * this.power / 1000 };
You can’t perform that action at this time.