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 / 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>
@ksmithbaylor
ksmithbaylor / index.html
Last active August 29, 2015 14:12
color-hashes
<body>
<script src="minified.js"></script>
</body>
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/';
// 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;
@ksmithbaylor
ksmithbaylor / gist:3180048
Created July 26, 2012 03:20
Troubleshooting the jruby-rawr-swt-helloworld template
I actually just fixed it! Here's what was happening, in case the information is useful to you.
I am using OS X 10.7.4, rawr 1.4.5, and jruby 1.6.7.
After doing a git pull, I did the following:
$ ./bin/build-osx-app.sh
$ open package/osx/jruby-rawr-swt-helloworld.app
The app then launches for a split second and then quits.

A fix for Ghost taking too long to authenticate due to some strange behavior in the bcrypt-nodejs library. This simply makes the passwords hash using Sha1 instead of bcrypt. Probably not the best/cleanest/most secure solution, but it works for most purposes.

INSTRUCTIONS:

  1. In the file core/server/models/user.js, replace the 'add' function with the contents of user-add.js.
  2. In the same file, replace the 'check' function with the contents of user-check.js.
  3. At the top, add the line 'sha1 = require('sha1'),' in the require section.
  4. In package.json, add the following line in the 'dependencies' section: "sha1": "1.1.0",
  5. You can remove references to the bcrypt library if you want. These are the only two places it is used.
  6. Remove all users from the databases in content/data/ by executing 'delete from users;' on the sqlite db (or delete the whole database if there's not anything important there yet).
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}`
})
});
}
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
// 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))
; 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)))