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
// @param - timeStamp - Javascript Date object or date string | |
// @usage - timeSince(new Date().setFullYear(2019)) | |
function timeSince(timeStamp) { | |
if (!(timeStamp instanceof Date)) { | |
timeStamp = new Date(timeStamp); | |
} | |
if (isNaN(timeStamp.getDate())) { | |
return "Invalid date"; | |
} |
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
var Alarm = function () { | |
this.name; | |
this.scheduledTime; | |
this.periodInMinutes; | |
}; | |
var AlarmManager = function () { | |
var alarms = {}, | |
timerOuts = {}, | |
timerIntervels = {}, |
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
//Javascript for finding latitude and longitude range boundaries. | |
//Based on the excellent Java example by http://janmatuschek.de/LatitudeLongitudeBoundingCoordinates | |
var GeoLocation = GeoLocation ? GeoLocation : { | |
TO_RADIAN: 0.0174532925, | |
TO_DEGREE: 57.2957795, | |
EARTH_RADIUS: 6371.01, | |
TO_MILE: 0.621371192, | |
TO_KM: 1.609344, | |
MIN_LAT: function() { return GeoLocation.degreeToRadian(-90) }, |
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 | |
# | |
# Watch current directory (recursively) for file changes, and execute | |
# a command when a file or directory is created, modified or deleted. | |
# | |
# Written by: Senko Rasic <senko.rasic@dobarkod.hr> | |
# | |
# Requires Linux, bash and inotifywait (from inotify-tools package). | |
# | |
# To avoid executing the command multiple times when a sequence of |
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
// | |
// GeoLocationUtils.m | |
#import "GeoLocationUtils.h" | |
@implementation GeoLocationUtils | |
float TO_RADIAN = 0.0174532925, |
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
* { | |
background: #000 !important; | |
color: #0f0 !important; | |
outline: solid #f00 1px !important; | |
} |
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
[{"name":"Colombo","channels":[{"map":"r_PK61Dt","href":"/listen/coop-radio/r_PK61Dt","title":"Coop Radio","subtitle":"Maharagama","id":"id8a401705-6766-9164-17ce-a5346f2fa38e","name":"Coop Radio","src":"https://radio.garden/api/ara/content/listen/r_PK61Dt/channel.mp3?id8a401705-6766-9164-17ce-a5346f2fa38e"},{"map":"fo8bhE4s","href":"/listen/free-fm/fo8bhE4s","title":"Free FM","subtitle":"Kotikawatta","id":"id26060e93-15ee-1442-f1ac-0c7a7aec0e8d","name":"Free FM","src":"https://radio.garden/api/ara/content/listen/fo8bhE4s/channel.mp3?id26060e93-15ee-1442-f1ac-0c7a7aec0e8d"},{"href":"/listen/hirufm/xyIbSGbn","title":"Hiru FM 96.1","id":"idffeeb3c7-4ada-af94-0ab8-926609a1e0f2","name":"Hiru FM 96.1","src":"https://radio.garden/api/ara/content/listen/xyIbSGbn/channel.mp3?idffeeb3c7-4ada-af94-0ab8-926609a1e0f2"},{"map":"xyIbSGbn","href":"/listen/hirufm/xyIbSGbn","title":"Hiru FM 96.1","subtitle":"Colombo","id":"id420953ad-8179-234b-0ef9-b5587c5c4eca","name":"Hiru FM 96.1","src":"https://radio.garden/api/ara/conten |
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
class Palindrome: | |
@staticmethod | |
def is_palindrome(word): | |
word = word.lower() | |
l = len(word) // 2 | |
palindrome = True | |
for i in range(l): | |
j = -(i+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
// FIRST METHOD | |
// Count using array | |
arr = new Array(26).fill(0); | |
s = "ABCAZZ" // Input String | |
for (var i = 0; i < s.length; i++) { | |
var index = s.charCodeAt(i) - 'A'.charCodeAt(0); | |
arr[index] += 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
#!/usr/bin/env python | |
import os | |
import sys | |
import boto3 | |
from datetime import datetime, timezone | |
from urllib.request import pathname2url | |
import mimetypes | |
# upload_dir_s3.py /path/to/local/folder thebucketname /path/to/s3/folder |
OlderNewer