Skip to content

Instantly share code, notes, and snippets.

View mattbasta's full-sized avatar
🌭
Still writing JavaScript

Matt Basta mattbasta

🌭
Still writing JavaScript
View GitHub Profile
@mattbasta
mattbasta / linkedList.bt
Last active August 29, 2015 14:16
Super basic implementation of linked lists in BType
object LinkedList {
with T;
LinkedListNode<T>:first;
LinkedListNode<T>:last;
int:length;
append(T:value) {
var node = new LinkedListNode<T>(self, value);
self.length = self.length + 1;
@mattbasta
mattbasta / gist:0a61de4cd67ddd9b55f7
Created December 7, 2014 17:03
node octane results
node node_modules/.bin/benchmark-octane
hostname : bastamac.local
node version : v0.10.33
V8 version : 3.14.5.9
platform & arch : darwin x64
config : { target_defaults:
{ cflags: [],
default_configuration: 'Release',
defines: [ 'OPENSSL_NO_SSL2=1', 'OPENSSL_NO_SSL3=1' ],
@mattbasta
mattbasta / gist:bdfdb1af8b6cbc6a9b74
Created December 7, 2014 17:02
iojs octane results
./out/Release/node node_modules/.bin/benchmark-octane
hostname : bastamac.local
node version : v0.13.0-pre
V8 version : 3.29.93.1
platform & arch : darwin x64
config : { target_defaults:
{ cflags: [],
default_configuration: 'Release',
defines: [ 'OPENSSL_NO_SSL2=1' ],
@mattbasta
mattbasta / gist:1d51ec8be17102b61073
Created December 1, 2014 03:25
fix for every problem ever.js
// Today:
var some_object = {'error': 'hey'};
console.error('oh no blah blah ' + some_object);
// prints: oh no blah blah [object Object]
// But then debug:
Object.prototype.valueOf = function() {return JSON.stringify(this);};
// then later
var some_object = {'error': 'hey'};
@mattbasta
mattbasta / gist:6c30883fd797af52bdac
Created September 16, 2014 17:10
Terminal output while compiling HHVM
bastamac:hhvm matt$ cmake . -DCMAKE_CXX_COMPILER=$(brew --prefix gcc48)/bin/g++-4.8 -DCMAKE_C_COMPILER=$(brew --prefix gcc48)/bin/gcc-4.8 -DCMAKE_ASM_COMPILER=$(brew --prefix gcc48)/bin/gcc-4.8 -DLIBIBERTY_LIB=$(brew --prefix gcc48)/lib/x86_64/libiberty-4.8.a -DCMAKE_INCLUDE_PATH="/usr/local/include:/usr/include" -DCMAKE_LIBRARY_PATH="/usr/local/lib:/usr/lib" -DLIBEVENT_LIB=$(brew --prefix libevent)/lib/libevent.dylib -DLIBEVENT_INCLUDE_DIR=$(brew --prefix libevent)/include -DICU_INCLUDE_DIR=$(brew --prefix icu4c)/include -DICU_LIBRARY=$(brew --prefix icu4c)/lib/libicuuc.dylib -DICU_I18N_LIBRARY=$(brew --prefix icu4c)/lib/libicui18n.dylib -DICU_DATA_LIBRARY=$(brew --prefix icu4c)/lib/libicudata.dylib -DREADLINE_INCLUDE_DIR=$(brew --prefix readline)/include -DREADLINE_LIBRARY=$(brew --prefix readline)/lib/libreadline.dylib -DCURL_INCLUDE_DIR=$(brew --prefix curl)/include -DCURL_LIBRARY=$(brew --prefix curl)/lib/libcurl.dylib -DBOOST_INCLUDEDIR
@mattbasta
mattbasta / format_timing_data.js
Created May 5, 2014 01:16
Snippet for formatting timing information
Object.keys(Timing.files).forEach(function(file) {
console.log(file + Array(100 - file.length).join('-'));
var markers = Timing.markers[file];
markers.forEach(function(marker, i) {
console.log(
marker.name +
Array(100 - marker.name.length).join(' ') +
(i !== markers.length - 1 ?
markers[i + 1].start - marker.start :
0)
-----BEGIN PGP MESSAGE-----
Version: Keybase OpenPGP v0.1.12
Comment: https://keybase.io/crypto
wcFMA7LsuxndRu81ARAAvAZ2D2ODxY9mzO8Q7A/JqMrWzm1XJkh9Q6t1hvKN2t7P
jhUBWzfZbhdDEL1klQ9/+08QQAqEcuhtTRvYUv1l2R/SjD9fNST9jPs3kwYml63J
c8GwrXRUA3GcV3DrY27GdgqAiooEhzGMgFZhj4S+ApwrJLE3jWb73lEVhZmhkPJn
CCTcr7nteSjHEBnijCwNMp9uB9ioe1A7MtIBsd8PzwCI7TY3Ma9St627BgrbaO3i
dqKpFqnXR3ba8D+ty6QWFCe60udMvTxYj8OOcEwydHq3KGdbK5W/NvRgABQS+itt
kYl7RrDqEvU6H00c/oRZc5dyhayyJh0+WodZHsbgbJusanDCsJ7sShk4/5ulvGpj
var irc = require('irc');
var client = new irc.Client('irc.mozilla.org', 'carly_rae_jenkins', {
channels: ['#amo', '#breakpad'],
});
function contains(message, list) {
for(var i=0;i<list.length;i++) {
var l = list[i];
if(message.indexOf(l) > -1)
return true;
var pt=performance.timing,rs=pt.responseStart;console.log([pt.domLoading-rs,pt.responseEnd-rs,pt.domContentLoadedEventStart-rs,pt.domContentLoadedEventEnd-rs,pt.loadEventStart-rs,pt.loadEventEnd-rs].join(','));location.reload()
function notify(title, body, icon, callback) {
if (window.Notification) {
function donotify() {
var notification = new Notification(title, {
body: body,
icon: icon
});
notification.onclick = callback;
}
if (Notification.permission === 'granted') {