Skip to content

Instantly share code, notes, and snippets.

View SerkanSipahi's full-sized avatar
🎯
Focusing

Bitcollage SerkanSipahi

🎯
Focusing
View GitHub Profile
@domenic
domenic / HTMLMediaElement.js
Created October 14, 2014 15:51
HTMLMediaElement.js skeleton
import conversions from "webidl-conversions";
import reflector from "webidl-html-reflector";
var defineProperty = Object.defineProperty;
export default class CustomHTMLMediaElement extends HTMLElement {
get error() {}
get src() {
return reflector["DOMString"].get(this, "src");
}
set src(v) {
v = conversions["DOMString"](v);
@Component({
selector: 'my-app',
template: `<hello></hello>`
})
export class AppComponent {
name = 'Angular';
}
@Component({
selector: 'hello',
@WebReflection
WebReflection / lys.js.md
Last active March 21, 2019 22:05
A `lys.js` crazy non sense

lys is a programming language that produces WASM, and its design goal is to be as simple as possible, yet useful to create utilities.

I've been thinking about a subset of JavaScript that could run natively on the browser, similarly to asm.js, but with the ability, through a dedicated parser, to target another language able, on its own, to produce WASM.

The following crazy non sense works already thanks to an agglomerated of modern and deprecated JS features and it might be interesting as experiment to see if a JS to WASM compiler, through the lys indirection, could be possible.

function lys(fn) {

  /*! (c) Andrea Giammarchi */
@armanozak
armanozak / index.ts
Last active October 1, 2020 10:22
[Variadic Tuples & Recursive Conditional Types] How tagged template literals can return type-safe functions #typescript #tip
type Repeat<T, Count, Acc extends any[] = []> = Acc['length'] extends Count ? Acc : Repeat<T, Count, [...Acc, T]>;
function i18n<Keys extends number[]>([result, ...parts]: TemplateStringsArray, ...keys: Keys) {
return (...param: Repeat<string, Keys['length']>) =>
keys.reduce((acc, key, i) => acc + (param as number[])[key] + parts[i], result);
}
const introduceEn = i18n`Hi. My name is ${0}. I work as a ${1} at ${2}.`;
const introduceTr = i18n`Merhaba. Benim adım ${0}. ${2} şirketinde ${1} olarak çalışıyorum.`;
// (param_0: string, param_1: string, param_2: string) => string
@KittyGiraudel
KittyGiraudel / gist:9488917
Created March 11, 2014 16:04
A question regarding Sass & Gzip

About Sass and Gzip

Hey guys! I have a question regarding Sass usage and Gzip compression. If anyone knows something, be sure to share. :)

A quick reminder

It's good practice to use Sass @extend rather than including mixins when possible because of the way Sass handles @extend. To put it simple, it doesn't take the CSS content from the extended selector to place them in the extending one. It works the other way around: it takes the extending selector and append it to the extended selector.

Placeholder

@armanozak
armanozak / index.ts
Created October 1, 2020 16:21
[Strict Contract] How to create a binding interface #typescript #tip
type Strict<Contract, Class> = Class extends Contract
? { [K in keyof Class]: K extends keyof Contract ? Contract[K] : never }
: Contract;
interface MyContract {
foo: number;
bar: boolean;
}
type MyStrictContract = Strict<MyContract, MyClass>;
@vsavkin
vsavkin / angular-ends-in-toronto.md
Last active April 24, 2022 21:34
Nrwl is Hiring Angular Engineers in Toronto!

Nrwl is Hiring Angular Engineers in Toronto!

logo

Are you a Senior Angular engineer who continually self-trains to build cutting-edge skills? Do you love the challenge of helping teams with real-world product goals? Want to play with Angular thought-leaders and enterprise development teams?

We Have:

  • Distributed company with folks all over North America
@LayZeeDK
LayZeeDK / direct-standalone-dependencies.md
Last active June 10, 2022 08:01
Indirect dependencies between components declared by NgModules. Standalone Angular components are easier to understand for both developers and compilers. "imports" means import statements in these diagrams.
  graph TD;
      A[ParentComponent]--imports-->B[ChildComponent];
@toolmantim
toolmantim / Makefile
Last active December 5, 2022 23:14
An example of using Make instead of Grunt for fast, simple and maintainable front-end asset compilation.
# A simple Makefile alternative to using Grunt for your static asset compilation
#
## Usage
#
# $ npm install
#
# And then you can run various commands:
#
# $ make # compile files that need compiling
# $ make clean all # remove target files and recompile from scratch
import {readFileSync} from 'fs';
import {execSync} from 'node:child_process';
import {exec} from 'child_process';
import util from 'util';
export const execAsync = util.promisify(exec);
execSync('npx nx graph --file=workspace-graph.json').toString('utf-8');