View ir.js
// Source code: | |
// | |
// int a = 25 | |
// int b = 20 | |
// int c = 0; | |
// | |
// if (a + b > 40) { | |
// c = 1; | |
// } else { | |
// c = 0; |
View data-to-human-readable.js
const bytesInKilobyte = 1000 | |
const bytesInMegabyte = 1000000 | |
const bytesInGigabyte = 1000000000 | |
const bytesInTerabyte = 1000000000000 | |
function toHumanReadable(bytes) { | |
if (bytes >= bytesInTerabyte) return Math.round(bytes / bytesInTerabyte * 100) / 100 + " tb"; | |
if (bytes >= bytesInGigabyte) return Math.round(bytes / bytesInGigabyte * 100) / 100 + " gb"; | |
if (bytes >= bytesInMegabyte) return Math.round(bytes / bytesInMegabyte * 100) / 100 + " mb"; | |
if (bytes >= bytesInKilobyte) return Math.round(bytes / bytesInKilobyte * 100) / 100 + " kb"; |
View brainfuck.html
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
<style media="screen"> | |
body * { | |
margin: 10px; | |
padding: 0; | |
display: block; |
View charly-bubblesort.ch
Array.methods.sort = ->{ | |
let sorted = @copy() | |
let left | |
let right | |
@length().times(func(i) { | |
(@length() - 1).times(func(y) { | |
left = sorted[i] |
View interpreter.ch
class Lexer { | |
property tokens | |
property source | |
property pos | |
property buffer | |
func constructor() { | |
@tokens = [] | |
@token = null | |
@source = "" |
View display.js
const leftpad = require('left-pad'); | |
const fs = require('fs'); | |
const chars = [ | |
[ | |
'┌─┐', | |
'│ │', | |
'│ │', | |
'│ │', | |
'└─┘', |
View microsoft.js
const microsoft = function(name) { | |
const microsoft = (Math.random() < 0.5) ? 'microsoft ' : ''; | |
const smart = (Math.random() < 0.5) ? 'smart ' : ''; | |
const center = (Math.random() < 0.5) ? ' center' : ''; | |
const fullname = microsoft + smart + name + center; | |
return fullname.trim(); | |
} | |
module.exports = microsoft; |
View header.scss
$decrease: 4; | |
$initial: 28; | |
@for $i from 1 through 6 { | |
> h#{$i} { | |
// Formula: https://www.desmos.com/calculator/dhrvkbio8f | |
font-size: 1px * ($initial - (2 * $decrease)) + (pow($decrease, 2) / pow(2, $i)); | |
} | |
@if $i < 6 { | |
> h#{$i} + h#{$i+1} { |
View setup.sh
# Install git | |
sudo apt-get install git | |
sudo mkdir ~/github/ | |
# Uninstall all previous copies of vim | |
sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-common vim-gui-common | |
sudo apt-get build-dep vim-gnome | |
sudo apt-get install python-dev libncurses5-dev | |
sudo rm -rf /usr/local/share/vim | |
sudo rm /usr/bin/vim |
View get.js
export default function get(url, method, options, _callback) { | |
// Allow the options to be optional | |
if (typeof options == 'function') { | |
_callback = options; | |
options = {}; | |
} | |
// Wrap the _callback | |
const callback = function(err) { |
NewerOlder