Skip to content

Instantly share code, notes, and snippets.

@sktwentysix
sktwentysix / sketchapp_line_CSS
Last active February 4, 2022 11:34
Convert SketchApp line height to CSS
/*
Sketchapp fro MacOS is a fantastic tool for prototyping, but has some drawbacks that make converting designs to fully functional websites a pain.
One of these is sketchapp's line-height, which doesn't seem to have any relation to CSS line-height values.
This is a simple example of how we can take a line height value from sketch and apply it to a CSS class for styling text:
Lets assume the text in our Sketchapp prototype has a font size of "18px", and line height of "33"...
Our CSS class would look like this:
@joseluisq
joseluisq / database.module.ts
Last active April 18, 2023 07:40
Nest Database Module (Type ORM) with environment variables support
import { Module, Global, DynamicModule } from '@nestjs/common'
import { EnvModule } from './env.module'
import { EnvService } from './env.service'
import { TypeOrmModule } from '@nestjs/typeorm'
function DatabaseOrmModule (): DynamicModule {
const config = new EnvService().read()
return TypeOrmModule.forRoot({
type: config.DB_TYPE,
@riodw
riodw / MongoDB-UserCollection-Data-Change_Send-Change-SocketIO.js
Created February 7, 2018 19:20
Notify socket.io users when MongoDB data collection changes
/* MongoDB-UserCollection-Data-Change_Send-Change-SocketIO.js */
'use strict'
module.exports = function (
app,
io,
User // Collection Name
) {
// SET WATCH ON COLLECTION
const changeStream = User.watch();
@rshaker
rshaker / .block
Last active December 7, 2023 10:41
Update and transition of pie chart
license: mit
@ackuser
ackuser / get_gmail.py
Created November 20, 2017 14:44 — forked from tyndyll/get_gmail.py
Extract Mail from GMail and Import into Neo4J
#!/usr/local/env python
import argparse
import email
import extract
import getpass
import imaplib
import os
import sys
import uuid
@victor-shelepen
victor-shelepen / operations-component.ts
Created October 25, 2017 10:06
This component displays a list of operations. It retrieves data from two observables. The data source of the table is created once. The data change is initated by Behaviour Subject dataS. Data retring process is locate in the function `update`. mat-table component uses the directive trackBy that have to optimize the output. But it still blinking.
import {Component, ViewChild, OnInit} from '@angular/core';
import {ForexService} from '../../../service/forex';
import {DataSource} from '@angular/cdk/collections';
import {Observable} from 'rxjs/Observable';
import {BehaviorSubject} from 'rxjs/BehaviorSubject';
import 'rxjs/operator/map';
import {MatDialog, PageEvent} from '@angular/material';
import {MatSort} from '@angular/material';
import {IPaginator} from '../../../../core/lib/interface';
import {ConfirmDialogComponent, IConfirmDialogAnswer, IConfirmDialogData} from '../../../../core/dialog/confirm';
@igogrek
igogrek / How I stopped loving Angular.md
Last active April 2, 2024 03:00
How I stopped loving Angular

I've worked with AngularJS for many years now and still use it in production today. Even though you can't call it ideal, given its historically-formed architecture, nobody would argue that it became quite a milestone not only for evolution of JS frameworks, but for the whole web.

It's 2017 and every new product/project has to choose a framework for development. For a long time I was sure that new Angular 2/4 (just Angular below) will become the main trend for enterprise development for years to come. I wasn't even thinking of working with something else.

Today I refuse to use it in my next project myself.

@snewell92
snewell92 / ResponsiveService.js
Last active May 11, 2021 21:35
Angular Responsive Service
/* TYPESCRIPT */
import { Injectable } from '@angular/core';
@Injectable()
export class ResponsiveService {
constructor() {
window.onresize = this.callSubscribers
}
export function logger( reducer ) {
return function newReducer( state, action ) {
console.group(action.type);
const nextState = reducer(currentState, action);
console.log(`%c prev state`, `color: #9E9E9E; font-weight: bold`, state);
console.log(`%c action`, `color: #03A9F4; font-weight: bold`, action);
console.log(`%c next state`, `color: #4CAF50; font-weight: bold`, nextState);
console.groupEnd();
return nextState;
}
@zwinnie
zwinnie / font-awesome-4.7.0.json
Created April 28, 2017 20:23
JSON Of All Font Awesome 4.7.0 Icons
{
"4.7.0": [
"fa-500px",
"fa-address-book",
"fa-address-book-o",
"fa-address-card",
"fa-address-card-o",
"fa-adjust",
"fa-adn",
"fa-align-center",