Skip to content

Instantly share code, notes, and snippets.

View aroman's full-sized avatar
👋
hiring!

Avi Romanoff aroman

👋
hiring!
View GitHub Profile
// dim_windows method copied with animation effects removed, kept dock methods to update dock with first switch
void window_delay() {
var current_actor = current_window.get_compositor_private() as Actor;
var i = counter = 0;
foreach (var clone in window_clones) {
if (current_actor == clone.source) {
set_child_below_sibling(clone, dock_background);
dock.get_child_at_index(i).animate(AnimationMode.LINEAR, 100, opacity: 255);
} else {
@aroman
aroman / wat.js
Last active August 29, 2015 14:00
// Client from MongoDB
{
"_id": {
"$oid": "52ec25f12ebb928c81b4d2c8"
},
"name": "test",
"redirect_uri": "http://localhost:3001/oauth_test",
"trusted": true
}
@aroman
aroman / ab.js
Created May 13, 2014 20:58
named closures
// is this...
mongoose.connection.on('error', function onConnectionError(err) { // Closure is named
console.log('Error: Can not connect to DB'.red);
console.log(err.toString().red);
process.exit(1);
});
// ...better than this?
mongoose.connection.on('error', function (err) { // Closure is NOT named
console.log('Error: Can not connect to DB'.red);
Tue, 13 May 2014 21:03:47 GMT uncaughtException Uncaught, unspecified "error" event.
TypeError: Uncaught, unspecified "error" event.
at TypeError (<anonymous>)
at Function.EventEmitter.emit (events.js:74:15)
at _rejected (/Users/sutter/Developer/io/node_modules/kraken-js/node_modules/q/q.js:797:24)
at /Users/sutter/Developer/io/node_modules/kraken-js/node_modules/q/q.js:823:30
at Promise.when (/Users/sutter/Developer/io/node_modules/kraken-js/node_modules/q/q.js:1035:31)
at Promise.promise.promiseDispatch (/Users/sutter/Developer/io/node_modules/kraken-js/node_modules/q/q.js:741:41)
at /Users/sutter/Developer/io/node_modules/kraken-js/node_modules/q/q.js:557:44
at flush (/Users/sutter/Developer/io/node_modules/kraken-js/node_modules/q/q.js:108:17)
@aroman
aroman / email.js
Created May 17, 2014 15:15
mocha + async test isolation
module.exports.send = function (template, model, recipient, subject, callback) {
async.waterfall([
function readTemplate (wf_callback) {
fs.readFile(path.join(__dirname, TEMPLATES_DIR, template), wf_callback);
},
function renderTemplate (data, wf_callback) {
wf_callback(null, data.toString());
},
[_LOG_LEVEL_DEBUG 08:54:29.417854] SearchManager.vala:215: Replace "private" with "public"
[_LOG_LEVEL_INFO 08:54:29.446488] SearchManager.vala:173: 13 occurrences found
[_LOG_LEVEL_DEBUG 08:54:29.851415] SearchManager.vala:215: Replace "private" with "public"
[_LOG_LEVEL_INFO 08:54:29.869035] SearchManager.vala:173: 12 occurrences found
[_LOG_LEVEL_INFO 08:54:30.392455] SearchManager.vala:173: 0 occurrences found
[_LOG_LEVEL_FATAL 08:54:30.611825] [GLib-GObject] g_object_unref: assertion 'G_IS_OBJECT (object)' failed
[_LOG_LEVEL_FATAL 08:54:30.611909] Scratch will not function properly.
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff5b18297 in g_slice_alloc () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
<snip>
CC libgtkinspector_la-object-hierarchy.lo
CC libgtkinspector_la-prop-editor.lo
CC libgtkinspector_la-prop-list.lo
CC libgtkinspector_la-python-hooks.lo
CC libgtkinspector_la-python-shell.lo
CC libgtkinspector_la-resource-list.lo
CC libgtkinspector_la-resources.lo
CC libgtkinspector_la-signals-list.lo
CC libgtkinspector_la-size-groups.lo
~ $ xinput list-props bcm5974
Device 'bcm5974':
Device Enabled (135): 1
Coordinate Transformation Matrix (137): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
Device Accel Profile (262): 1
Device Accel Constant Deceleration (263): 2.500000
Device Accel Adaptive Deceleration (264): 1.000000
Device Accel Velocity Scaling (265): 12.500000
Synaptics Edges (266): -3791, 4311, 423, 6027
Synaptics Finger (267): 70, 75, 0
@aroman
aroman / iso-to-usb.md
Last active June 18, 2017 01:52
Creating a Mac-bootable USB drive from an elementary OS ISO

How to turn an Isis ISO into USB installation media

Using the command line

  1. Download the ISO. Let's assume it's in ~/Downloads.
  2. Convert the ISO to DMG format: hdiutil convert -format UDRW -o isis elementaryos-unstable-amd64.20140529.iso.
  3. Insert your >1GB USB drive into your Mac.
  4. Determine and make note of the mount point of your USB drive.

Using Disk Utility

@aroman
aroman / thiny.js
Last active August 29, 2015 14:02
// a library
{
"books": [
ObjectId(507c7f79bcf86cd7994f6cAB),
ObjectId(507c7f79bcf86cd7994s320e),
ObjectId(507c7f79bcf86cd7994s221e)
],
"name": "New York Public Library",
"_id": ObjectId(507c7f7921sa6cd7994s22LB)
}