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
convert_format = function(time) { | |
var hour = Number(time.replace(/:[0-9]+/, '').replace(/ *[a-z]+/, '')) | |
, min = Number(time.replace(/[0-9]+:/, '').replace(/ *[a-z]+/, '')) | |
, ampm = time.replace(/[0-9]+:/, '').replace(/[0-9]+ */, ''); | |
if(ampm !== '') { | |
// Convert to 24 hour time(Removing ampm) | |
// Time: 0:00 - 23:59 | |
if(hour === 12 && ampm === 'am') hour = 0; |
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
disp_time = function(obj) { | |
if(obj.length > 0) { | |
var time = new Date() | |
, tillNextMin = (60 - time.getSeconds()) * 1000 | |
, waitLoop | |
, timeLoop; | |
obj.html(current_time()); | |
waitLoop = setTimeout(function() { | |
clearTimeout(waitLoop); |
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
disp_date = function(obj) { | |
if(obj <= 0) return; | |
var date = new Date() | |
, tillNextDay = (24 - date.getHours()) * 3600000 | |
, waitLoop | |
, dateLoop; | |
obj.html(current_date()); | |
waitLoop = setTimeout(function() { |
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
alarmTime = "13:30"; // 1:30 pm | |
set_alarm = function() { | |
// Convert alarmTime to 24 format if it's 12 format | |
var alarmCopy = (Options.timeFormat === '12') ? toggle_time_format(alarmTime) : alarmTime | |
, time = new Date() | |
, cHour = time.getHours() | |
, cMin = time.getMinutes() | |
// Extract hour and minute from alarmCopy string | |
, aHour = Number(alarmCopy.replace(/:[0-9]+/, '')) |
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 { | |
margin:0; | |
padding:0; | |
font-family:Helvetica, Verdana, Arial, sans-serif; | |
font-size:14px; | |
color:rgb(100,100,100); | |
} | |
header, nav, footer {margin:0;padding:0;display:block;} | |
img {outline:none;border:none;} | |
a {text-decoration:none;} |
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
Main = -> | |
this.index = (req, res, params) -> | |
this.respond params, | |
format: 'html' | |
template: 'app/views/main/index' | |
exports.Main = Main | |
### | |
# Compiled JS output |
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
function rn { | |
local app_name=$1 | |
shift | |
# Doing "$@" will include all arguments(Including the app name) | |
# But if you make it skip the first argument it will fix that (: | |
rails new $app_name --skip-bundle "${@:2}" && cd $app_name && bundle install --local | |
} |
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
#!/bin/bash | |
if [[ "$1" != "" ]]; then | |
pdf_file="$1" | |
shift | |
rm /tmp/pdf_file.txt >> /dev/null 2>&1 | |
if [[ ! -f $(which pdftotext) ]]; then | |
echo "You do not have xpdf installed, please install it to convert pdfs to text..." | |
exit 1 |
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
githubAccount() { # Syntax: githubAccount <file> | |
# Check for Github account name | |
if [[ "$githubAccount" == '' ]]; then | |
if [[ ! -f "$file" ]]; then | |
# If .github doesn't exist then ask for the name and save it | |
echo -n "What is your Github name? " | |
read githubAccount | |
touch "$file" | |
echo "$githubAccount" > "$file" | |
else |
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
/* | |
* Truncate(string<String>, options<Object>, callback[Function]) | |
* | |
* Truncates a given `string` after a specified `length` if `string` is longer than | |
* `length`. The last characters will be replaced with an `omission` for a total length not | |
* exceeding `length`. If `callback` is given it will fire if `string` is truncated. | |
* | |
* Options: | |
* length <Integer> Length the output string will be(default: 30) | |
* omission <String> Replace last letters with an omission(default: '...') |