Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fabien0102
fabien0102 / Utils.tsx
Created August 31, 2018 14:21
Debounce component render
import { DebounceSettings } from "lodash";
import lodashDebounce from "lodash/debounce";
import isBoolean from "lodash/isBoolean";
import isEmpty from "lodash/isEmpty";
import React from "react";
export const isNotFilterValue = (value: any) => {
return !isBoolean(value) && isEmpty(value);
};
import React from "react";
import styled, { keyframes } from "react-emotion";
import { getConfig } from "../../getConfig";
import Wrapper from "./Wrapper";
export interface SelectFilterProps {
field: {
id: string;
name: string;
@fabien0102
fabien0102 / discordLogger.js
Created November 9, 2017 08:58
Discord logger
/* DEBUG WITH DISCORD */
const request = require("request");
const log = content => new Promise((resolve, reject) => {
const options = {
method: 'POST',
url: `${discordWebhookURL}`, // <- setup your discord webhook url here
headers: { 'content-type': 'application/json' },
body: { content: "```json\n" + JSON.stringify(content, null, 2) + "\n```" },
json: true
};
@fabien0102
fabien0102 / gitlog.js
Last active January 16, 2017 08:58
Git log as a json
// Usage:
// 1. Paste this file into root directory
// 2. Exec `node gitlog.js > output.json` in a console
// 3. Do what you want with output.json \o/
const exec = require('child_process').exec;
// see https://git-scm.com/docs/pretty-formats for placeholder codes
const fields = {
refs: { value: '%d', parser: a => a.replace(/[\(\)]/g, '').replace('->', ',').split(', ').map(a => a.trim()).filter(a => a) },
@fabien0102
fabien0102 / diacritics.js
Last active July 16, 2016 15:24
Diacritics remover
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@fabien0102
fabien0102 / PSDValidatorHOG.jsx
Last active June 6, 2016 10:09
Unit tests for photoshop. Example from Hidden Object Game naming rules (1 folder per object with 4 specifics layers).
#target photoshop
var document = app.activeDocument;
var itemsTypes = "obscured,hotspot,whole,shadow";
var output = "";
for ( var i = 0; i < document.layerSets.length; i++) {
validateLayerSet(document.layerSets[i]);
};
@fabien0102
fabien0102 / gist:7b5dabc790cac98618ab
Created March 17, 2015 14:42
Delete a fail commit
git rebase --onto XXX~1 XXX
@fabien0102
fabien0102 / gist:88dcaa184d801fd5e67a
Created March 15, 2015 09:33
Import multiple json files into mongoDB
ls -1 *.json | while read jsonfile; do mongoimport -d support -c logs -file $jsonfile --jsonArray -type json; done