Skip to content

Instantly share code, notes, and snippets.

Avatar
📚
published "Learn React Hooks"!

Daniel Bugl omnidan

📚
published "Learn React Hooks"!
View GitHub Profile
@omnidan
omnidan / coffea-starter-hashtags.js
Last active May 29, 2016
coffea-starter with hashtag detection
View coffea-starter-hashtags.js
import dude from 'debug-dude'
const { /*debug,*/ log, info /*, warn, error*/ } = dude('bot')
import { version } from '../package.json'
info(`coffea-starter bot v${version} starting`)
import config from '../config.json'
import { connect, message } from 'coffea'
const networks = connect(config)
View combineFilters.js
const arg1 = (arg) => arg !== 1
const arg2 = (arg) => arg !== 2
function combineFilters (filters) {
return filters.reduce((prev, curr) =>
(arg) => prev(arg) && curr(arg)
, () => true)
}
console.log(combineFilters([arg2, arg1, arg1])(1)); // false
@omnidan
omnidan / 0_reuse_code.js
Created Mar 16, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View keybase.md

Keybase proof

I hereby claim:

  • I am omnidan on github.
  • I am omnidan (https://keybase.io/omnidan) on keybase.
  • I have a public key ASCJG4SarPaxkAeGXuy6ABt_zAPFl5nsgZRRfv91HPK8JQo

To claim this, I am signing this object:

@omnidan
omnidan / countTrelloTasks.js
Last active Oct 30, 2015
webhook to listen to trello tasks in a `Done` list
View countTrelloTasks.js
'use strict'
let createStore = require('redux').createStore
let express = require('express')
let bodyParser = require('body-parser')
let fs = require('fs')
// --
@omnidan
omnidan / bot.js
Last active Aug 29, 2015
simple coffea irc bot
View bot.js
var client = require('coffea')({
host: 'chat.freenode.net',
nick: 'coffea-testbot',
channels: ['#caffeinery']
});
client.on('command', function (event) {
switch (event.cmd) {
case 'ping':
event.reply('pong');
View chop-benchmark.js
var chops = {};
var benchmark = false;
// solution 1
chops['indexOf'] = function (needle, haystack) {
return haystack.indexOf(needle);
};
// put your other solutions here in the same way as above
@omnidan
omnidan / Mocha.sublime-build
Created Aug 12, 2014
Mocha build script for sublime text 2/3
View Mocha.sublime-build
{
"shell_cmd": "mocha --require should --bail --reporter spec --no-colors $file",
"shell": true
}
@omnidan
omnidan / PyBorg-highlight-reply.patch
Created Jul 25, 2014
PyBorg: Always reply on highlight
View PyBorg-highlight-reply.patch
Subject: [PATCH] always reply to highlight
---
lib/pyborg/pyborg-irc.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/pyborg/pyborg-irc.py b/lib/pyborg/pyborg-irc.py
index 8b8e715..7e1ec25 100755
--- a/lib/pyborg/pyborg-irc.py
+++ b/lib/pyborg/pyborg-irc.py
@omnidan
omnidan / PrettyJsonResponse.php
Last active Jul 17, 2019
Pretty-printed Symfony JsonResponse class. 100% compatible with the original class, requires PHP 5.4.0 or higher.
View PrettyJsonResponse.php
<?php
/**
* @license WTFPL (Do What the Fuck You Want to Public License)
* @author Daniel Bugl <daniel.bugl@touchlay.com>
*/
namespace TouchLay\HelperBundle\Component;
use Symfony\Component\HttpFoundation\JsonResponse;