Skip to content

Instantly share code, notes, and snippets.

View usmonster's full-sized avatar
🫖

Usman usmonster

🫖
  • Paris, New York, Internet
View GitHub Profile
@usmonster
usmonster / markdown-details-collapsible.md
Last active November 6, 2020 22:17 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.
1. Click to expand!


Peek-a-boo!

2. Click to expand!
  • One
  • Two
  • But also
@usmonster
usmonster / slack-messaging-rank.js
Created September 12, 2019 07:44
A little JS snippet you can run from the browser console of the Slack stats page to see the "true ranking" of top message senders
// 1. go to https://{YOUR_SLACK_DOMAIN}.slack.com/stats#members
// 2. open the browser console
// 3. enter this (note: it might warn you that pasting code is bad):
$.post(`/api/team.stats.listUsers?_x_id=${boot_data.version_uid.slice(0,8)}-${Math.round(performance.now()*100)/100}`, {
count: 50,
sort_prefix: 'chats_sent',
sort_dir: 'desc',
date_range: '30d',
set_active: true,
token: boot_data.api_token,
@usmonster
usmonster / textContent.js
Last active April 11, 2024 06:18 — forked from eligrey/textContent.js
Updated Node.prototype.textContent shim for IE8 ONLY
(function() {
// inspired by Eli Grey's shim @ http://eligrey.com/blog/post/textcontent-in-ie8
// heavily modified to better match the spec:
// http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Node3-textContent
if (Object.defineProperty && Object.getOwnPropertyDescriptor &&
Object.getOwnPropertyDescriptor(Element.prototype, 'textContent') &&
!Object.getOwnPropertyDescriptor(Element.prototype, 'textContent').get) {
// NOTE: Neither of these "drop-in" patterns would work:
// Object.defineProperty(..., ..., descriptor); // nope!
@usmonster
usmonster / aight_textContent_test.html
Created May 22, 2014 15:59
tests for Element.prototype.textContent shim INCOMPLETE DRAFT
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<script type="text/javascript">
var log;
if ('console' in window && 'log' in window.console) {
log = function (x){ console.log(x); };
} else {
@usmonster
usmonster / aight_textContent_bug.html
Last active August 29, 2015 13:57
bug in aight's shim for Element.prototype.textContent
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<script type="text/javascript">
function test() {
try {
var e = document.createElement('div');
e.innerHTML = '&nbsp;';
@usmonster
usmonster / lp2gh-vesuvius.sh
Last active January 4, 2016 20:29
Steps to export Vesuvius from LP to GH. Result here: https://github.com/usmonster/vesuvius-test
# Steps to export Vesuvius from LP to GH.
# Replace [username] and ~/path/to/vesuvius with the appropriate values.
# NOTE: This is NOT a script, but a series of commands you should run by hand.
# Also, much of this was found on http://flexion.org/posts/2012-10-migrating-bzr-to-git.html .
# get the tools
sudo apt-get update
sudo apt-get install bzr-fastimport # adds fast-export to bzr if you don't already have it
sudo apt-get upgrade git # make sure git is the most current!
@usmonster
usmonster / ie8CssOutlineNoneBug.html
Last active December 25, 2015 16:49
The CSS rule `outline:none;` causes IE8 to barf when accessing a target element's `.currentStyle["outline"]` (or `.currentStyle["outlineWidth"]`). Fun! If you must, use instead `outline:0;` or `outline:none 0;`. (But really, [just avoid it](http://www.outlinenone.com), okay?) (Note: this is fine when in a newer IE version but in "IE8 Standards m…
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta charset="utf-8" />
<title>title</title>
</head>
<body>
<div id="foo" style="outline:none;">Test</div>
<script language="javascript" type="text/javascript">
data:text/html, <html>
<!--
modified from http://pastebin.com/4z8tttuA
answer to http://stackoverflow.com/questions/15582152/turns-browser-into-notepad-but-cant-save-html-contenteditable
-->
<style type="text/css">
body{overflow:hidden;}
#iframe{display:none;}
#div{position:absolute;top:0px;left:0px;width:100%;height:10000px;}
#saveButton{z-index:2;position:absolute;top:0px;right:0px;}
@usmonster
usmonster / Posts.scala
Created May 15, 2012 08:30
Maybe we don't need to modify anything (signaturewise)? Maybe this is enough?
// ...
@Signature(parameters=Array("post_type", "subdomain", "group", "title", "body", "author"))
def create_post(post_type: String, subdomain: String, group: String, title:String = null, body:String, author:String) = wrap {
// not sure if this is efficient, but you get the idea
val CreatePost = post_type match {
case "short_post" => CreateShortPost(GroupRef(subdomain, group), body, UserRef(author))
case "long_post" => CreateLongPost(GroupRef(subdomain, group), title, body, UserRef(author))
// ... case else invalid
}