Skip to content

Instantly share code, notes, and snippets.

app.directive('timePicker', function(){
return {
restrict: 'A',
replace: true,
scope: {
time: '='
},
templateUrl: 'js/partials/time-picker.html',
link: function(scope, el, attr){
<div class="timePickerWrap">
<input ng-model="time" class="timePickerInput" type="text">
<ul ng-show="showTimeDropdown" class="timePicker">
<li>0:00 AM</li>
<li>0:30 AM</li>
<li>1:00 AM</li>
<li>1:30 AM</li>
<li>2:00 AM</li>
<li>2:30 AM</li>
<li>3:00 AM</li>
.timePicker {
list-style-type: none;
background-color: #fff;
width: 80px;
margin: 0;
padding: 0;
height: 200px;
overflow-y: auto;
box-shadow: 1px 1px 3px rgba(0,0,0,0.4);
font-family: sans-serif;
@ishanray
ishanray / Timezone Hash
Created January 14, 2015 15:12
Ruby Snippets
displayedTimezones =
"Pacific/Midway" : "International Date Line West"
"Pacific/Midway" : "Midway Island"
"Pacific/Pago_Pago" : "American Samoa"
"Pacific/Honolulu" : "Hawaii"
"America/Juneau" : "Alaska"
"America/Los_Angeles" : "Pacific Time (US & Canada)"
"America/Tijuana" : "Tijuana"
"America/Denver" : "Mountain Time (US & Canada)"
"America/Phoenix" : "Arizona"
var lines = input.split('\n');
var wordlist = lines[0];
var wordScoresDict = {};
wordlist.map(word => wordScoresDict[word.toLowerCase()] = 0);
var hotels = [];
for (var i = 0, l = lines.length; i < l; i++) {
@ishanray
ishanray / index.html
Created March 20, 2018 21:28
preview uploaded images
<form id="form1" runat="server">
<input type='file' id="imgInp" multiple='true' />
<div id="preview"></div>
</form>
@ishanray
ishanray / controller.rb
Last active March 24, 2018 04:40
file upload ajax
bucket = Aws::S3::Bucket.new(name: 'truck-parts')
@signed_upload_url = bucket.presigned_post(
key: 'public/${filename}',
success_action_status: '201',
acl: 'public-read',
signature_expiration: 1.minute.from_now
)
@ishanray
ishanray / pre-push
Created May 1, 2018 05:22
Don't push to master
#!/bin/bash
protected_branch='master'
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
if [ $protected_branch = $current_branch ]
then
read -p "You're about to push master, is that what you intended? [y|n] " -n 1 -r < /dev/tty
echo
if echo $REPLY | grep -E '^[Yy]$' > /dev/null
import { serverSupabaseClient } from '#supabase/server'
import { DateTime, Duration, Interval } from 'luxon'
export class Slotter {
from: DateTime
to: DateTime
timeblocks: {
dow: number
}[]
group: Object