Skip to content

Instantly share code, notes, and snippets.

View Vishal-Isharani's full-sized avatar
🏠
Working from home

Vishal Isharani Vishal-Isharani

🏠
Working from home
View GitHub Profile
@Vishal-Isharani
Vishal-Isharani / historyState.ts
Created July 6, 2022 10:17
Konva js Undo/Redo History
import Konva from 'konva';
import { ShapeConfig } from 'konva/lib/Shape';
export class HistoryStat {
private static _instance: HistoryStat;
public _currentStat: any[] = [];
private _currentPointer: number = -1;
private _history: Array<Object[]> = [];
@alvaropinot
alvaropinot / map-to-object.js
Created October 3, 2017 17:58
"FUNctional" 😜 Map 🗺 to object 🔑
const obj = { a: 1, c: 3, b: 2 }
// Map from object.
const myMap = new Map(Object.entries(obj))
// Map to Object.
// NOTE: Keys will be cast to strings by `.toString`, so any "complex" key like for example `[1, 2]` will become `1,2`
const newObj = [...myMap.entries()]
.reduce((acc, [key, value]) => (Object.assign(acc, { [key]: value })), {})
@hygull
hygull / LICENSE KEY FOR SUBLIME TEXT 3 BUILD 3143.md
Last active December 16, 2023 19:30
LICENSE KEY FOR SUBLIME TEXT 3 BUILD 3143

STEPS

  • Click on Help menu

  • Select Enter License

  • Then paste given KEY given at bottom

  • Finally click on Use License

import { Directive, ElementRef, forwardRef, Input, Renderer2 } from '@angular/core';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { fromEvent } from 'rxjs/observable/fromEvent';
import { merge } from 'rxjs/observable/merge';
import { timer } from 'rxjs/observable/timer';
import { Subscription } from 'rxjs/Subscription';
export const DEFAULT_VALUE_ACCESSOR : any = {
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => NgControlOptionsDirective),

As you start out with your Electron app, you'll start to notice some features which have been carried directly across from the browser realm but make less sense for a desktop app. Here are the ones I can remember:

Ctrl or + Click Opens Links in New Window

In Electron just like in Chrome, if you hold down the Ctrl key (or on Mac) while clicking a link it opens in a new window. For many SPA apps, this is undesired and will load another full copy of your app in another window. You can disable this by calling the following code once you've created a BrowserWindow

win = new BrowserWindow({ ... });
@in4lio
in4lio / vCard_S30.py
Last active April 17, 2024 22:18
Сonvert vCards into suitable for Nokia Series 30+ format
r"""
vCard_S30.py -- Convert vCards into suitable for Nokia Series 30+ format, or
How to solve the only one phone number per contact problem.
1) Import contacts "contacts.vcf" from Google account (vCard format).
2) Place it beside this script.
3) Run the script with Python 2.7.
4) Copy the result "backup.dat" into "Backup" folder on the phone SD card.
5) Restore contacts from backup on the phone.
@btroncone
btroncone / ngrxintro.md
Last active June 26, 2024 08:27
A Comprehensive Introduction to @ngrx/store - Companion to Egghead.io Series

Comprehensive Introduction to @ngrx/store

By: @BTroncone

Also check out my lesson @ngrx/store in 10 minutes on egghead.io!

Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!

Table of Contents

@Yimiprod
Yimiprod / difference.js
Last active July 13, 2024 15:07
Deep diff between two object, using lodash
/**
* This code is licensed under the terms of the MIT license
*
* Deep diff between two object, using lodash
* @param {Object} object Object compared
* @param {Object} base Object to compare with
* @return {Object} Return a new object who represent the diff
*/
function difference(object, base) {
function changes(object, base) {
@Gr8Gatsby
Gr8Gatsby / toast.js
Last active January 24, 2020 11:09
Create a custom toast message and respond to the activation event recieved from the user selection.
(function () {
"use strict";
function createToast(message, imgUrl, imgAlt) {
// Namespace: Windows.UI.Notifications
if (typeof Windows !== 'undefined' &&
typeof Windows.UI !== 'undefined' &&
typeof Windows.UI.Notifications !== 'undefined') {
// Setup variables for shorthand
var notifications = Windows.UI.Notifications,
@taivo
taivo / x-editable-radiolist
Last active March 2, 2019 09:23
radiolist support for x-editable
/**
List of radio buttons. Unlike checklist, value is stored internally as
scalar variable instead of array. Extends Checklist to reuse some code.
@class radiolist
@extends checklist
@final
@example
<a href="#" id="options" data-type="radiolist" data-pk="1" data-url="/post" data-title="Select options"></a>
<script>