Skip to content

Instantly share code, notes, and snippets.

View jaldhar's full-sized avatar

Jaldhar H. Vyas jaldhar

View GitHub Profile
@jaldhar
jaldhar / reversell.cc
Created July 4, 2018 15:10
Reverse a singly-linked list
// Assuming a linked list that looks like this:
template <typename T>
class List {
public:
// ...
void reverse();
private:
struct Node {
T value_;
@jaldhar
jaldhar / gist:bae299ee03df93fcdd3633d751581e0b
Created July 27, 2017 07:10
Trying to implement an iterator in Perl6
=begin pod
Algorithm::DawkinsWeasel is a simple model illustrating the idea of cumulative
selection in evolution.
The original form of it looked like this:
1. Start with a random string of 28 characters.
2. Make 100 copies of this string, with a 5% chance per character of that
character being replaced with a random character.
@jaldhar
jaldhar / triangle.cc
Created June 23, 2017 04:20
Fold a string into a triangle
// triangle -- Fold a string into a triangle.
//
// From https://codegolf.stackexchange.com/questions/127649/fold-a-string-into-a-triangle
//
// By Jaldhar H. Vyas <jaldhar@braincells.com>
// Copyright (C) 2017, Consolidated Braincells Inc. All rights reserved.
// "Do what thou wilt shall be the whole of the license."
//
// Given a string whose length is divisible by 4, make a triangle as
// demonstrated below.
@jaldhar
jaldhar / learn-ide.mdwn
Last active March 12, 2017 15:55
Setting up learn IDE for Chrome on Ubuntu Linux and KDE 5

If you are trying to get an "Open" button on learn.co to launch their atom-based IDE and nothing is happening, you are probably missing a protocol handler. This is how I fixed the problem.

(Note this has only been tested on Ubuntu Linux 16.04 with KDE 5. It may not be valid for other configurations.)

  1. create a file in $(HOME)/.local/share/applications called learn-ide.desktop. It should have atleast the following contents:
[Desktop Entry]
Type=Application