Skip to content

Instantly share code, notes, and snippets.

View eioo's full-sized avatar
👨‍💻
­onpas

Kalle eioo

👨‍💻
­onpas
  • Finland
View GitHub Profile
import * as _ from 'lodash';
interface IAny {
[x: string]: string | number;
}
export default function arrayDiff(oldArray: Array<IAny>, newArray: Array<IAny> ): object {
const additions = _.differenceWith(newArray, oldArray, _.isEqual);
const removals = _.differenceWith(oldArray, newArray, _.isEqual);
return { additions, removals };
{
"React component": {
"prefix": "rcc",
"body": [
"import * as React from 'react';",
"",
"class ${TM_FILENAME_BASE} extends React.Component {",
" public render() {",
" return (",
" <div>",
function hexRgb(hexColor) {
const color = hexColor.startsWith('#') ? hexColor.substr(1) : hexColor;
if (color.length === 3) {
return color.match(/.{1,1}/g).map(hex => parseInt(hex + hex, 16));
} else if (color.length === 6) {
return color.match(/.{1,2}/g).map(hex => parseInt(hex, 16));
}
}
import * as childProcess from 'child_process';
import * as express from 'express';
import * as util from 'util';
const exec = util.promisify(childProcess.exec);
const DEPLOY_FOLDER = 'X:\\Desktop\\Tuplabotti-Jr';
const PORT = 2840;
class WebHook {
lastProcess: childProcess.ChildProcess;
interface IExtendedChart extends Chart {
scales: Chart.ChartScales;
chart: Chart;
width: number;
}
interface IExtendedChartConfig extends Chart.ChartConfiguration {
lineAtY: Array<number>;
}
body {
background: cyan;
}
button {
padding: 20px 10px;
}
@eioo
eioo / rng.ts
Last active December 19, 2018 19:24
import { promisify } from 'util';
import * as crypto from 'crypto';
import * as path from 'path';
import * as puppeteer from 'puppeteer';
import * as fs from 'fs';
interface ITargets {
targetInfos: any;
}
public class AntibanItem extends ClientAccessor {
public String name;
public int min;
public int max;
public int current;
public boolean disabled;
public abstract void execute();
public AntibanItem(ClientContext ctx) {
super(ctx);
function(file, callback) {
var HASH_CHUNK_SIZE = 65536, //64 * 1024
longs = [],
temp = file.size;
function read(start, end, callback) {
var reader = new FileReader();
reader.onload = function(e) {
callback.call(reader, process(e.target.result));
};
package main
import (
"bufio"
"fmt"
"log"
"os"
"strings"
)