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
import { NgModule } from '@angular/core';
import {
WebBluetoothModule
} from '@manekinekko/angular-web-bluetooth';
@NgModule({
imports: [
//...,
WebBluetoothModule.forRoot()
],
//...
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
// import BluetoothCore and types
import {
BluetoothCore,
BluetoothRemoteGATTServer,
BluetoothRemoteGATTService,
BluetoothRemoteGATTCharacteristic,
DataView
} from '@manekinekko/angular-web-bluetooth';
@manekinekko
manekinekko / angular-1-typescript.md
Created January 25, 2017 14:57
Writing AngularJS (>=1.5) component using Angular (>=2) approach with TypeScript...

If you want to write an AngularJs (1.5) component using Angular (>=2) approach, you could use:

In app.module.ts

import { FooComponent } from './foo.component';

angular.module('app.module', [])
  .component('fooComponent', FooComponent);
@manekinekko
manekinekko / programmez-203_code-01.ts
Created February 6, 2017 10:53
Code sample from my article: "Say Hi to Angular" published at Programmez! http://www.programmez.com/magazine/article/dites-bonjour-angular
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
  1. https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Objets_globaux/Array/filter
  2. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes
  3. https://github.com/tc39/proposal-decorators
  4. http://www.typescriptlang.org/play/
  5. https://vsavkin.com/writing-angular-2-in-typescript-1fa77c78d8e8#.f4uerqr3t
  6. https://angular2-wc-interop.firebaseapp.com/
  7. http://slides.com/wassimchegham/angular2-universal
  8. https://www.youtube.com/watch?v=aWM-_majn0E
  9. [https://github.com/manekinekko/angular2-d
@manekinekko
manekinekko / 🤘.js
Created February 23, 2017 14:07
Dependency Injector Library
/**
* Dependency Injector module.
* @type {Class}
* @author Wassim Chegham
*/
class DI {
dependencies = {};
modules = {};
factory(ctor, deps) {
return new ctor.apply(ctor, deps);
@manekinekko
manekinekko / check-permutation.js
Last active March 12, 2017 23:26
Check if "s1" is a permutation of "s2"
function checkPermutationWithSort(s1, s2) {
if (s1.length > 0 && s1.length === s2.length) {
return Array.from(s1).sort().join('') === Array.from(s2).sort().join('');
}
return false;
}
function checkPermutationWithDatastructure(s1, s2) {
const m = {};
for(let x=0; x<s1.length; x++) {
<section>
{% if title %}
<h2>{{ title }}</h2>
{% endif %}
{{ content_1 }}
{% if content_2 %}
{{ content_2 }}
{% endif %}
// this code sample is just for fun
// WARNING: don't write this ugly code in production
(async (a) => {
for await (const o of (async function* () {yield* await a })()) {
console.log(o);
}
})(Promise.all([1,2,3]));
@manekinekko
manekinekko / privacy-policy.html
Last active July 25, 2017 22:36
Generic Privacy Policy
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<body>
<h2>Privacy Policy</h2>
<p>Wassim Chegham built [[ APPLICATION_NAME ]] as a open source app. This SERVICE is provided by Wassim Chegham at no cost and is intended
for use as is.</p>
<p>This page is used to inform website visitors regarding my policies with the collection, use, and
disclosure of Personal Information if anyone decided to use my Service.</p>