Skip to content

Instantly share code, notes, and snippets.

View manekinekko's full-sized avatar
:octocat:
Check me out on Twitter @manekinekko

Wassim Chegham manekinekko

:octocat:
Check me out on Twitter @manekinekko
View GitHub Profile
@manekinekko
manekinekko / 0-twig-and-angular2-integration.md
Last active July 22, 2021 17:21
Use a Twig template with Angular2 components

This is an attempt to add Twig templating support to Angular 2 (WIP)

@manekinekko
manekinekko / regex-es6-imports.js
Last active February 1, 2024 16:05
A regular Expression to parse ECMAScript6 import syntax
let regex = `import
(?:
["'\s]*
([\w*{}\n, ]+)
from\s*
)?
["'\s]*
([@\w/_-]+)
["'\s]*
;?
@manekinekko
manekinekko / window-object-node-js.js
Last active October 5, 2017 18:45
Prevent users to access Window properties on server side
declare module NodeJS {
interface Global {
window: any | Window;
}
}
global.window = {};
/**
* Warn the developer about direct access to Window props
@manekinekko
manekinekko / MyModule.ts
Created March 13, 2016 21:27
Typescript and AngularJs 1.x
export let MyModule = angular.module('MyModule', []);
@manekinekko
manekinekko / angular2-beta3-to-rc1.md
Last active May 26, 2016 19:51
Migration Angular 2 apps from (old) Beta 3 to RC1

1) update package.json

"@angular/common": "2.0.0-rc.1",
"@angular/compiler": "2.0.0-rc.1",
"@angular/core": "2.0.0-rc.1",
"@angular/http": "2.0.0-rc.1",
"@angular/platform-browser": "2.0.0-rc.1",
"@angular/platform-browser-dynamic": "2.0.0-rc.1",
"@angular/router-deprecated": "2.0.0-rc.1",
@manekinekko
manekinekko / app.component.ts
Last active July 8, 2016 13:50
Organizing Angular 2 imports...
import { MD_DIRECTIVES } from './md.providers.ts';
@Component({
//...
directives: [MD_DIRECTIVES]
})
//...
@manekinekko
manekinekko / angular2-form-upgrade.md
Last active July 19, 2016 09:15
Angular 2 new form API
@manekinekko
manekinekko / angularjs-infinite-scroll.js
Last active August 10, 2016 20:51
ngInfiniteScroll is a directive for AngularJS to evaluate an expression when the bottom of the directive's element approaches the bottom of the browser window, which can be used to implement infinite scrolling.
/* ng-infinite-scroll - v1.1.2 - 2014-05-21 */
/* original code: https://github.com/sroze/ngInfiniteScroll/issues/69#issuecomment-51181292 */
var mod;
mod = angular.module('infinite-scroll', []);
mod.value('THROTTLE_MILLISECONDS', null);
mod.value('THROTTLE_DISTANCE', 20);
import { Component, OnInit, NgZone } from '@angular/core';
import { BatteryLevelService } from '../battery-level.service';
import { BluetoothCore } from '@manekinekko/angular-web-bluetooth';
@Component({
selector: 'ble-battery-level',
//...
providers: [ BatteryLevelService, BluetoothCore ]
})
export class BatteryLevelComponent implements OnInit { //...