Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block omarstreak

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
omarstreak / getCursorContext.js
Created Dec 6, 2017
Function to get information around cursor
View getCursorContext.js
/* @flow */
/* this code heavily borrows from */
export type CursorContext = {
textNode: Node;
textNodeParent: Node;
textNodeContent: string;
textBeforeCursor: string;
textAfterCursor: string;
omarstreak / load.js
Last active Oct 24, 2017
sdk load example
View load.js
InboxSDK.load(2, 'YOUR_APP_ID_HERE', {suppressAddonTitle: 'YOUR_ADD_ON_TITLE_HERE'}).then(function(sdk){
//more code
View inboxsdk-threadrowview-stream-example.js
var emitter; //variable name to hoist the emitter to
var stream ={
emitter = inEmitter;
return function(){}; //we need to return a function that gets called when the stream ends
threadRowView.addLabel(stream); //add the label passing in the stream
omarstreak /
Created Jan 18, 2013
Create and sign your safari extension file
EXTENSION=your extension name
$XAR -czf $EXTENSION.safariextz --distribution $EXTENSION.safariextension
$XAR --sign -f $EXTENSION.safariextz --digestinfo-to-sign digest.dat --sig-size `cat $BUILD_DIR/size.txt` --cert-loc $BUILD_DIR/cert.der --cert-loc $BUILD_DIR/cert01 --cert-loc $BUILD_DIR/cert02
openssl rsautl -sign -inkey $BUILD_DIR/key.pem -in digest.dat -out sig.dat
$XAR --inject-sig sig.dat -f $EXTENSION.safariextz
rm -f sig.dat digest.dat
View compose.js
document.addEventListener('DOMNodeInserted', function(e){
function addButton(composeNode){
var button = $('<div class="wG J-Z-I"><div class="J-J5-Ji J-Z-I-Kv-H"><div class="J-J5-Ji J-Z-I-J6-H"><div class="aA7 aaA aMZ"><img src="//composeIcon" /></div></div></div></div>');{
View compose.js
To inject a button into composes there's 5 main strategies an extension developer can use, each strategy has large tradeoffs
mainly around performance and ease of implementation. The result is that most extension developers opt for the
easy to implement but poor performing strategy.
Strategy 1
omarstreak / Install XAR
Created Jan 18, 2013
Bash script to install XAR. Run as root and takes one command line argument where you want the xar executable to exist.
View Install XAR
if [ "`whoami`" != "root" ]; then
printf "Please run this script as root or using sudo\n"
exit 0
printf "Setting up XAR\n"
omarstreak / Unquoted.js
Created Feb 1, 2016
Get unquoted text
View Unquoted.js
function extract(mv){
//NodeIterators are really cool:
var nodeIterator = document.createNodeIterator(
acceptNode: function(node){
//this is the main function where the interesting code occurs
//because node iterator is a recursive tree walk you'll see every node below the body element
//this includes nodes that contain both the html we want, and html we don't want
View gist:4076146
/* animation for even number of compose windows */
@-webkit-keyframes streakComposeTriggerEven {
from { clip: rect(1px, auto, auto, auto); }
to { clip: rect(0px, auto, auto, auto); }
.streakGmailComposeChildren:first-child:nth-last-child(2n) {
-webkit-animation-duration: 0.001s;
-webkit-animation-name: streakComposeTriggerEven;
omarstreak / table.html
Created Jul 9, 2012
Standard table structure
View table.html
You can’t perform that action at this time.