Skip to content

Instantly share code, notes, and snippets.

Marc Köhlbrugge marckohlbrugge

Block or report user

Report or block marckohlbrugge

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View news.ycombinator.com.css
body { background-color: rgb(246, 246, 239); margin-top: 0 }
.title { font-size: 16px; padding-top: .6em; padding-bottom: .3em; }
.athing > .votelinks { padding-top: .8em }
.subtext { font-size: 12px; }
.comment { font-size: 16px; line-height: 1.5; }
@marckohlbrugge
marckohlbrugge / countdown.rb
Last active Oct 10, 2018
Calculates estimated time it takes for a block to return zero. Useful when running operations in parallel (e.g. migrations).
View countdown.rb
# Calculates estimated time it takes for a block to return zero. Useful when
# running operations in parallel (e.g. migrations).
#
# Usage:
# Run in IRB/Rake/whatever: add_slugs_to_each_post # example of long-running operations
# Run in parallel IRB session: countdown { Post.where(slug: nil).count }
#
# sleep_time parameter is optional. The higher the value the more accurate the
# results, but the longer the method takes to run.
@marckohlbrugge
marckohlbrugge / unread_only.js
Created May 3, 2018
Hides all read chats so you only see unread chats. Save this as a bookmarklet with https://mrcoles.com/bookmarklet/ and run on https://web.telegram.org/#/im
View unread_only.js
$(".im_dialog_wrap .im_dialog_badge.ng-hide").each(function(index, el){$(el).parents("li.im_dialog_wrap").addClass("ng-hide");});
@marckohlbrugge
marckohlbrugge / wip_graphql_demo.rb
Last active Sep 24, 2019
Ruby example of creating a todo and then completing it using wip.chat graphql.
View wip_graphql_demo.rb
# NOTE: Be sure to set the API key further down in the code!
require "net/http"
require "uri"
require "json"
class WIP
def initialize(api_key:)
@api_key = api_key
end
View text_utils.rb
text = %{This validates there's a lot of attention and real business to be made targeting the nomad and remote work space. Even if nomads have previously had an image of low-income. There's money here.}
def garble(input, intro: 0)
length = input.length
output = []
for position in 0...length
percentage = (position / length.to_f)
output << if percentage < intro ||
percentage < rand ||
@marckohlbrugge
marckohlbrugge / wipchat.coffee
Last active Mar 24, 2018
ubersicht widget that pulls in next wipchat todo to work on
View wipchat.coffee
# This is a simple example Widget, written in CoffeeScript, to get you started
# with Übersicht. For the full documentation please visit:
#
# https://github.com/felixhageloh/uebersicht
#
# You can modify this widget as you see fit, or simply delete this file to
# remove it.
# this is the shell command that gets executed every time this widget refreshes
command: "whoami"
View com.marckohlbrugge.batchImportDvds.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1">
<dict>
<key>Label</key>
<string>com.marckohlbrugge.batchImportDvds</string>
<key>ProgramArguments</key>
<array>
<string>/Users/marc/Desktop/dvdcopy.sh</string>
</array>
View dvdcopy.sh
#/bin/bash
# README:
# - Make sure to make the script executable using chmod
# - chmod +x file_name.sh
# (chmod stands for change mode)
# (x stands for executable)
# This script builds upon the work of 'mrzarquon' found here:
# http://ask.metafilter.com/142872/Help-me-archive-a-roomful-of-old-Mac-data
@marckohlbrugge
marckohlbrugge / stripe-checkout.html
Last active Apr 20, 2017 — forked from ziadoz/stripe-checkout.html
Custom Stripe Checkout Button
View stripe-checkout.html
<style>
input[type="submit"] {
background-color: red;
color: white;
border-radius: 5px;
border: none;
font-size: 28px;
padding: 20px;
}
</style>
@marckohlbrugge
marckohlbrugge / gems.md
Last active Dec 20, 2015
Gems we use for BetaList commenting system
View gems.md

We recently implemented a commenting system on BetaList. It's still under heavy development, but here's an overview of the gems we're using so far:

  • acts_as_commentable_with_threading provides most of functionality you need
  • acts_as_votable makes the comments votable (so the best ones can rise to the top)
  • mention_system handles @mentions. this is a very young gem, but seems to work fine
  • mailboxer is a very robust notification system (we notify the startup when there's a comment, when someone replies to your comment, and when you are @mentioned)
You can’t perform that action at this time.