Skip to content

Instantly share code, notes, and snippets.

View akiva's full-sized avatar

Akiva Levy akiva

View GitHub Profile

Installing Arch Linux on the Dell XPS 13 (2015)

Preparation

First, create a bootable USB stick using the latest Arch Linux installation image.[1][1]

Since the Dell XPS 13 ships with a Broadcom wireless adapter, this will not be supported with the included drivers within the Arch Linux image. To get around this, first download the [broadcom-wl][2] package from

var request = require('request');
var JSONStream = require('JSONStream');
request({ url: 'http://reddit.com/.json' })
.pipe(JSONStream.parse('data.children.*.data.title'))
.on('data', function (data) {
console.log(data);
});
// users.js
exports.list = function (options) {
return function (req, res, ...) {
// ...
}
}
// app.js
var users = require('./routes/users');
function fizzbuzz(n) {
var output = '';
if (n % 3 === 0) output += 'Fizz';
if (n % 5 === 0) output += 'Buzz';
if (!output) output = n;
return output;
}
for (var i = 1; i < 100; i++) {
console.log(fizzbuzz(i));
// Merge arrays into single array, removing duplicates. This version
// removes objects that are duplicates by values, not memory pointers,
// ie. `{ foo: 'bar' }` and `{ foo: 'bar' }` are seen as duplicates
function mergeArrays() {
var args = arguments;
var hash = {};
var arr = [];
for (var i = 0; i < args.length; i++) {
// Find which line number a 0-based index falls on by splitting a line
// of text delimited by '\n'
function getLineNumberByCharIndex(index) {
var TEXT = 'abc\ndef\nghijkl\nmnop';
var line = 0;
var i;
for (i = 0; i <= index; i++) {
if (TEXT[i] === '\n') line++;
// Create a function that accepts 2 arguments. Both arguments
// should be arrays of integers. The function should return the
// differences between the first and second arrays.
//
// Example:
//
// Array One [1, 2, 4]
// Array Two [2, 3]
//
// [1, 2, 4] => [2, 3]
var human = { race: 'human' };
var person = { name: 'Jim', age: 26 };
function mixin(target, source, props) {
props = props || Object.keys(source);
props.forEach(function(prop) {
target[prop] = source[prop];
});
function fibonacci(n) {
return (n < 2) ? n : fibonacci(n - 1) + fibonacci(n - 2);
}
// F0 = 0, F1 = 1, F2 = 1, F3 = 2, F10 = 55
for (var i = 1; i <= 10; i++) {
console.log(fibonacci(i));
}

Keybase proof

I hereby claim:

  • I am akiva on github.
  • I am akiva (https://keybase.io/akiva) on keybase.
  • I have a public key whose fingerprint is F05B 121F 6E07 3216 BE35 E425 5524 34F0 F754 BE67

To claim this, I am signing this object: