This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create a 2d array | |
function createGrid(rows, columns) { | |
var grid = new Array(rows); | |
for(var i = 0; i < rows; i++) { | |
grid[i] = new Array(columns); | |
for(var j = 0; j < columns; j++) { | |
grid[i][j] = 0; | |
} | |
} | |
return grid; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create a 2d array | |
function createGrid(rows, columns) { | |
var grid = new Array(rows); | |
for(var i = 0; i < rows; i++) { | |
grid[i] = new Array(columns); | |
for(var j = 0; j < columns; j++) { | |
grid[i][j] = 0; | |
} | |
} | |
return grid; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table> | |
<tbody> | |
<tr> | |
<td>...</td> | |
<td>...</td> | |
... | |
</tr> | |
... | |
</tbody> | |
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "`whoami`" != "root" ]; then | |
printf "Please run this script as root or using sudo\n" | |
exit 0 | |
fi | |
LIB_DIR=$1 | |
CURRENT_DIR=`pwd` | |
printf "Setting up XAR\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
XAR=path/to/xar/bin | |
BUILD_DIR=path/to/dir/with/cert/files | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//oauth2 auth | |
chrome.identity.getAuthToken( | |
{'interactive': true}, | |
function(){ | |
//load Google's javascript client libraries | |
window.gapi_onload = authorize; | |
loadScript('https://apis.google.com/js/client.js'); | |
} | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sdk.Lists.registerThreadRowViewHandler(function(threadRowView){ | |
var emitter; //variable name to hoist the emitter to | |
var stream = Kefir.stream(function(inEmitter){ | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Kefir from 'kefir'; | |
class ThreadDataManager { | |
constructor(){ | |
Kefir.stream(emitter => {this._emitter = emitter; return () => null}); | |
this._threadData = {}; //map from threadID to thread data | |
} | |
setThreadData(threadID, data){ | |
this._threadData[threadID] = data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function extract(mv){ | |
//NodeIterators are really cool: https://developer.mozilla.org/en-US/docs/Web/API/NodeIterator | |
var nodeIterator = document.createNodeIterator( | |
mv.getBodyElement(), | |
NodeFilter.SHOW_ELEMENT, | |
{ | |
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 |
OlderNewer