Skip to content

Instantly share code, notes, and snippets.

View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'VisitDays'
});
View Fancy PS1
_hadsuccess() {
if [ $? -eq 0 ]; then
echo '2';
else
echo '1';
fi
}
_gitbranch() {
if [ -d .git ]; then
@bdjnk
bdjnk / tint_hues.js
Created Sep 25, 2015
Generates and applies nice tint hues for your Lightning Launcher desktop wallpaper.
View tint_hues.js
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 Mar 11, 2018
Bash Suspend Alarm Clock with Gradual Volume and Fallback
View alarm.sh
#!/bin/bash
__script_version="1.1"
#-----------------------------------------------------------------------
# Default values
#-----------------------------------------------------------------------
human_time="6:20 tomorrow"
@bdjnk
bdjnk / lruc.sh
Last active Aug 29, 2015
LuaRocks Update Check Shell Script
View lruc.sh
#!/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 Aug 29, 2015
ScriptEd - HTML Form, JavaScript Functions
View ScriptEd 01
<!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 Aug 29, 2015
Script to enable page looping of the current container in LLX
View Container Loop
/* 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();