Skip to content

Instantly share code, notes, and snippets.

View light9's full-sized avatar

Alexey Horoshavin light9

  • New Delhi, India
View GitHub Profile
@caisback
caisback / Ubuntu 20_04 LTS - Installing Keycloak 12.0.4.md
Created April 17, 2021 13:31
Ubuntu 20.04 LTS - Installing Keycloak 12.0.4
@JamieMason
JamieMason / group-objects-by-property.md
Created September 14, 2018 07:38
Group Array of JavaScript Objects by Key or Property Value

Group Array of JavaScript Objects by Key or Property Value

Implementation

const groupBy = key => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = obj[key];
    objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
    return objectsByKeyValue;
@arleighdickerson
arleighdickerson / watch.js
Created December 24, 2017 17:25
hot reloading of server-side feathersjs application (put this in src/)
const logger = require('winston');
const invalidate = require('invalidate-module');
const { resolve } = require('path');
const chokidar = require('chokidar');
process.on('unhandledRejection', (reason, p) => {
logger.error('Unhandled Rejection at: Promise ', p, reason);
});
const src = (...args) => resolve(__dirname, ...args);
@johnpapa
johnpapa / .angular-cli.schema.json
Created November 21, 2017 14:11
Angular CLI Config Schema
{
"$schema": "http://json-schema.org/schema",
"id": "https://github.com/angular/angular-cli/blob/master/packages/@angular/cli/lib/config/schema.json#CliConfig",
"title": "Angular CLI Config Schema",
"type": "object",
"properties": {
"$schema": {
"type": "string"
},
"project": {
@codediodeio
codediodeio / database.rules.json
Last active July 24, 2024 21:05
Common Database Rules for Firebase
// No Security
{
"rules": {
".read": true,
".write": true
}
}
@haxpor
haxpor / setWebhook-telegram.txt
Last active April 6, 2024 12:00
How to set webhook url for bot on Telegram
https://api.telegram.org/bot<bot-token>/setWebhook?url=<webhook-url>
<bot-token> - bot token get from BotFather on Telegram
<webhook-url> - webhook url in base64
@jack-guy
jack-guy / feathers.d.ts
Last active September 7, 2017 10:34
These are basic typings for Feathers.js based off of those in DefinitelyTyped for Express. This doesn't type feathers plugins, but does have some interfaces that can be used in them. WIP.
// Type definitions for Feathers
// Project: http://feathersjs.com/
// Definitions by: Jack Guy <http://thatguyjackguy.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Application, Handler, ErrorRequestHandler } from 'express';
type HandlerArgument = Handler | Handler[];
export = Feathers;
@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) {
@rubenlagus
rubenlagus / Main.java
Last active May 31, 2021 13:22
Example of sending a SendMessage method using Telegram API with ReplyMarkupKeyboard
package org.telegram.example.SendMessage;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;
import java.io.IOException;
@aurbano
aurbano / removeKeys.js
Last active November 29, 2022 21:57
Remove a property from a nested object, recursively
/**
* Remove all specified keys from an object, no matter how deep they are.
* The removal is done in place, so run it on a copy if you don't want to modify the original object.
* This function has no limit so circular objects will probably crash the browser
*
* @param obj The object from where you want to remove the keys
* @param keys An array of property names (strings) to remove
*/
function removeKeys(obj, keys){
var index;