Skip to content

Instantly share code, notes, and snippets.

Usman usmonster

  • Paris, New York, Internet
Block or report user

Report or block usmonster

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
@usmonster
usmonster / textContent.js
Last active Aug 29, 2015 — forked from eligrey/textContent.js
Updated Node.prototype.textContent shim for IE8 ONLY
View textContent.js
(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
tests for Element.prototype.textContent shim INCOMPLETE DRAFT
View aight_textContent_test.html
<!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 Aug 29, 2015
bug in aight's shim for Element.prototype.textContent
View aight_textContent_bug.html
<!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 Jan 4, 2016
Steps to export Vesuvius from LP to GH. Result here: https://github.com/usmonster/vesuvius-test
View lp2gh-vesuvius.sh
# 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 Dec 25, 2015
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…
View ie8CssOutlineNoneBug.html
<!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">
View browserpad
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
Maybe we don't need to modify anything (signaturewise)? Maybe this is enough?
View Posts.scala
// ...
@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
}
You can’t perform that action at this time.