Skip to content

Instantly share code, notes, and snippets.

View ademilter's full-sized avatar

Adem ilter ademilter

View GitHub Profile
@ademilter
ademilter / DynamicText.jsx
Created February 28, 2022 22:06
Inter dynamic tracking as a React component
// https://rsms.me/inter/dynmetrics
const DynamicText = ({ className, children, fontSize = 15, tag = "span" }) => {
const pxToRem = (px) => {
return Number(px * 0.0625)
}
const dynamicLeading = (z) => {
const l = 1.4
return Number(pxToRem(Math.round(z * l)))
@ademilter
ademilter / event.ts
Created January 29, 2020 14:09 — forked from rsms/event.ts
type EventHandler<T=any> = (data :T)=>void
export class EventEmitter<EventMap = {[k:string]:any}> {
_events = new Map<keyof EventMap,Set<EventHandler>>()
addListener<K extends keyof EventMap>(e :K, handler :EventHandler<EventMap[K]>) {
let s = this._events.get(e)
if (s) {
s.add(handler)
} else {
@ademilter
ademilter / Close.vue
Created May 23, 2019 20:32 — forked from SinanMtl/Close.vue
Vue Icon Generate as Component
// assets/icons/Close.vue
<template>
<svg class="icon" xmlns="http://www.w3.org/2000/svg" :width='opts.width' :height='opts.height' viewBox="0 0 29 32">
<path :fill="opts.color" d="M27.507 7.418l-4.525-4.525-9.050 9.050-9.053-9.050-4.525 4.525 9.050 9.050-9.050 9.053 4.525 4.525 9.053-9.050 9.050 9.050 4.525-4.525-9.050-9.053z"></path>
</svg>
</template>
<script>
import icon from '@/mixins/icon'
@ademilter
ademilter / oneliners.js
Created April 1, 2019 15:13 — forked from mikowl/oneliners.js
👑 Awesome one-liners you might find useful while coding.
// By @coderitual
// https://twitter.com/coderitual/status/1112297299307384833
// Remove any duplicates from an array of primitives.
const unique = [...new Set(arr)]
// Sleep in async functions. Use: await sleep(2000).
const sleep = (ms) => (new Promise(resolve => setTimeout(resolve, ms)));
// Type this in your code to break chrome debugger in that line.
@ademilter
ademilter / sql-mongo_comparison.md
Created February 16, 2017 13:54 — forked from aponxi/sql-mongo_comparison.md
MongoDb Cheat Sheets

SQL to MongoDB Mapping Chart

SQL to MongoDB Mapping Chart

In addition to the charts that follow, you might want to consider the Frequently Asked Questions section for a selection of common questions about MongoDB.

Executables

The following table presents the MySQL/Oracle executables and the corresponding MongoDB executables.

import scala.collection.mutable
import scala.util.Random
/**
* Created by husrev on 10/02/16.
*/
object HelloApp extends App {
type Point = (Int, Int)
type Trace = List[Point]
@ademilter
ademilter / gulpfile.js
Created December 29, 2015 21:30 — forked from o/gulpfile.js
test for @ademilter
var gulp = require('gulp');
gulp.task('copy', function () {
return gulp
.src('index.js')
.pipe(gulp.dest('dist'))
})
$(function() {
var map = new google.maps.Map(document.getElementById("map_canvas"), {});
var newyork = new google.maps.LatLng(40.69847032728747, -73.9514422416687);
var googleMapWidth = $("#map_canvas").css('width');
var googleMapHeight = $("#map_canvas").css('height');
map.setCenter(newyork);
$('#enter-full-screen').click(function(){