This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Copy this file as `recint` (or whatever you want) somewhere in your path and | |
# use it according to the usage notes below! | |
if ARGV.size < 4 | |
puts "Usage: recint <collateral_factor> <supply_apr> <supply_bonus> <borrow_apr> <borrow_bonus>" | |
puts | |
puts " Example - To calculate the net interest on recursively lending this asset:" | |
puts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hello world | |
asdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; src/ui/helpers/antd.clj | |
(ns ui.helpers.antd) | |
(defn- has-dots? [sym] | |
(not (clojure.string/blank? (re-matches #".*\..*" (str sym))))) | |
(defn- to-property-access [name] | |
(symbol (str ".-" name))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Visit https://www.youtube.com/user/{username}/videos | |
// Keep scrolling down to trigger loading of all videos so they are all visible | |
// Run this to get the user's combined view count | |
function countViews() { | |
return Array.from(document.querySelectorAll('.yt-lockup-meta-info li')) | |
.map(li => li.textContent) | |
.filter(text => text.includes('views')) | |
.map(text => text.replace(',', '').replace(' views', '')) | |
.map(num => parseInt(num)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def factorial n | |
(1..n).reduce :* || 1 | |
end | |
def snake_case_paths size | |
factorial(2 * size) / factorial(size) ** 2 | |
end | |
puts snake_case_paths 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
function exec(command, env) { | |
require('child_process').execSync(command, { | |
stdio: 'inherit', | |
env: Object.assign({}, process.env, env, { | |
PATH: `./node_modules/.bin:${process.env.PATH}` | |
}) | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Splitting out conditionals makes things more readable | |
const someCondition = (something.is == true) | |
// Ternary expressions are really useful for assigning values in an immutable | |
// way. This avoids setting `a` to something as a "default", and then | |
// conditionally setting it to something else. | |
const a = someCondition ? | |
oneThing : | |
anotherThing; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var browserify = require('browserify'); | |
var watchify = require('watchify'); | |
var babelify = require('babelify'); | |
var uglifyify = require('uglifyify'); | |
var source = require('vinyl-source-stream'); | |
var chalk = require('chalk'); | |
var inputDir = './src/'; | |
var outputDir = './dist/'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
<script src="minified.js"></script> | |
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style type='text/css'>html, body { margin: 0; padding: 0; border: 0; }; body, html { height: 100%; width: 100%; }</style> | |
</head> | |
<body> | |
<script src="index.js"></script> | |
</body> | |
</html> |
NewerOlder