Skip to content

Instantly share code, notes, and snippets.

View DAB0mB's full-sized avatar
♥️
Single af

Eytan Manor DAB0mB

♥️
Single af
View GitHub Profile
@DAB0mB
DAB0mB / flatten_deep.js
Created December 31, 2017 06:30
A JavaScript function to flat an array recursively
function flattenDeep(array) {
if (!(array instanceof Array)) {
return array;
}
return array.reduce((flatArray, cell) => {
return flatArray.concat(flattenDeep(cell));
}, []);
}
@DAB0mB
DAB0mB / index.html
Created August 27, 2018 00:43
A sample Webflow page
<!DOCTYPE html>
<!-- This site was created in Webflow. http://www.webflow.com -->
<!-- Last Published: Mon Aug 27 2018 00:33:27 GMT+0000 (UTC) -->
<html data-wf-page="5b6195b59fe96a1ba86ba604" data-wf-site="5b6195b59fe96ad6326ba603">
<head>
<meta charset="utf-8">
<title>Campaign Kit</title>
<meta content="width=device-width, initial-scale=1" name="viewport">
<meta content="Webflow" name="generator">
<link href="css/normalize.css" rel="stylesheet" type="text/css">
@DAB0mB
DAB0mB / ConsultFormController.js
Created August 28, 2018 04:33
A sample controller for an Appfairy view
import React from 'react'
import ConsultFormView from '../views/ConsultFormView'
class ConsultFormController extends React.Component {
state = {}
render() {
return (
<ConsultFormView>
<name onChange={this.setName} />
@DAB0mB
DAB0mB / git_squence_editor.sh
Last active March 18, 2020 09:30
git_squence_editor.sh
git_sequence_editor () {
if test -z "$GIT_SEQUENCE_EDITOR"
then
GIT_SEQUENCE_EDITOR="$(git config sequence.editor)"
if [ -z "$GIT_SEQUENCE_EDITOR" ]
then
GIT_SEQUENCE_EDITOR="$(git var GIT_EDITOR)" || return $?
fi
fi
@DAB0mB
DAB0mB / git-remove.js
Last active September 3, 2018 10:06
usage: $ ./git-remove.js <anchor> <amount>
#!/usr/bin/env node
const execa = require('execa')
const fs = require('fs')
const tmp = require('tmp')
// Main
{
const [anchor, amount = 1] = process.argv.slice(-2).map(Number)
gitRebaseInteractive(anchor, function (operations, amount) {
const { spawn } = require('child_process')
spawn('git', ['log'])
const { spawn } = require('child_process')
spawn('git', ['log']).stdout.pipe(process.stdout)
const { spawn } = require('child_process')
spawn('git', ['log'], {
stdio: 'inherit' // Will use process .stdout, .stdin, .stderr
})
const { execFile } = require('child_process')
execFile('git', ['log'], (err, out) => {
if (err) {
console.error(err)
}
else {
console.log(out)
}
})
import { DocumentNode, GraphQLError } from 'graphql'
import { OperationVariables, FetchPolicy } from 'apollo-client'
import { useEffect, useMemo, useRef, useState } from 'react'
import { useApolloClient } from 'react-apollo-hooks'
import * as isEqual from 'react-fast-compare'
export type SubscriptionOptions<TVariables> = {
variables?: TVariables;
fetchPolicy?: FetchPolicy;
}