Skip to content

Instantly share code, notes, and snippets.

View ksmithbaylor's full-sized avatar
🐻
Sic 'em Bears!

Kevin Smith ksmithbaylor

🐻
Sic 'em Bears!
View GitHub Profile
@ksmithbaylor
ksmithbaylor / recint.rb
Last active January 5, 2022 16:30
Recursive Interest Calculator
#!/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
@ksmithbaylor
ksmithbaylor / foo.txt
Last active August 20, 2019 18:02
Testing
Hello world
asdf
; 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)))
// 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))
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
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}`
})
});
}
// 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;
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/';
@ksmithbaylor
ksmithbaylor / index.html
Last active August 29, 2015 14:12
color-hashes
<body>
<script src="minified.js"></script>
</body>
@ksmithbaylor
ksmithbaylor / index.html
Last active August 29, 2015 14:12
color-hashes
<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>