Skip to content

Instantly share code, notes, and snippets.

@bdjnk
bdjnk / controllers.application.js
Last active September 29, 2016 23:36
VisitDays
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'VisitDays'
});
@bdjnk
bdjnk / Fancy PS1
Last active November 13, 2015 00:40
_hadsuccess() {
if [ $? -eq 0 ]; then
echo '2';
else
echo '1';
fi
}
_gitbranch() {
if [ -d .git ]; then
@bdjnk
bdjnk / tint_hues.js
Created September 25, 2015 01:22
Generates and applies nice tint hues for your Lightning Launcher desktop wallpaper.
golden_ratio_conjugate = 0.618033988749895;
var desktop = LL.getCurrentDesktop();
var hue = desktop.getTag("hue");
if (!hue) { hue = Math.random(); }
else { hue = parseFloat(hue); }
hue += golden_ratio_conjugate;
hue %= 1;
desktop.setTag("hue", hue.toString());
@bdjnk
bdjnk / alarm.sh
Last active March 11, 2018 13:42
Bash Suspend Alarm Clock with Gradual Volume and Fallback
#!/bin/bash
__script_version="1.1"
#-----------------------------------------------------------------------
# Default values
#-----------------------------------------------------------------------
human_time="6:20 tomorrow"
@bdjnk
bdjnk / lruc.sh
Last active August 29, 2015 14:20
LuaRocks Update Check Shell Script
#!/bin/bash
cmd='luarocks-5.1'
all=`$cmd search --all`
rocks=`$cmd list | grep '^\w\S*$'`
IFS=$'\n'
for rock in $rocks
do
local_version=`$cmd list $rock | grep -A1 "^${rock}$" | grep -oE '^[\t ]+.+\-[0-9]+ '`
remote_version=`echo "$all" | grep -A1 "^${rock}$" | grep -oE '^[\t ]+.+\-[0-9]+ '`
if [ "$local_version" != "$remote_version" ]
@bdjnk
bdjnk / ScriptEd 01
Last active August 29, 2015 14:16
ScriptEd - HTML Form, JavaScript Functions
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<script>
function celsiusToFahrenheit(celsius) {
var fahrenheit = celsius * 9 / 5 + 32;
if ( ! celsius | isNaN(fahrenheit)) {
return "";
@bdjnk
bdjnk / Container Loop
Last active August 29, 2015 13:56
Script to enable page looping of the current container in LLX
/* Works only for an odd number of pages, with the
* 'home' page centered.
* Requires snap to pages and an extra blank page
* on either side.
* @pages number of pages on either side of 'home'.
*/
var e = LL.getEvent();
var c = LL.getContainer();
var pos = c.getPositionX();
var width = c.getWidth();