Skip to content

Instantly share code, notes, and snippets.

View techhahn's full-sized avatar

Pritesh Panjiker techhahn

View GitHub Profile
let timer = setInterval(() => {
if(window.cancelTimer && timer) {
clearInterval(timer);
}
fetch('https://cdn-api.co-vin.in/api/v2/appointment/sessions/calendarByPin?pincode=403508&date=14-05-2021').then(res => res.json()).then(obj => {
//Will have to check for the center and change it here
console.log(obj.centers);
obj.centers[1].sessions.forEach(slot => {
console.log(slot.available_capacity, slot.date);
if(slot.available_capacity) {
@techhahn
techhahn / example.txt
Created February 7, 2018 19:15
Any way to print proper values without moving setTimeout outside the loop?
//HTML
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
//JS
var list = document.querySelectorAll('li');
var listArr = Array.prototype.slice.call(list);
@techhahn
techhahn / app.js
Created November 4, 2017 18:58
Smooth Scroll plugin with callback support
var section = document.querySelector('.vs-section')
var smooth = new Smooth({
native: true,
section: section,
ease: 0.1,
callback: function(current) {
console.log(current);
}
});
@techhahn
techhahn / new webpack config
Last active December 27, 2016 21:02
Webpack basic setup
module.exports = {
entry: './app/index.js',
output: {
path: './dist/',
filename: 'bundle.js'
},
devServer: {
inline: true,
function _ago($tm,$rcs = 0) {
$cur_tm = time(); $dif = $cur_tm-$tm;
$pds = array('sec','min','h','d','w','m','y','decade');
$lngh = array(1,60,3600,86400,604800,2630880,31570560,315705600);
for($v = sizeof($lngh)-1; ($v >= 0)&&(($no = $dif/$lngh[$v])<=1); $v--); if($v < 0) $v = 0; $_tm = $cur_tm-($dif%$lngh[$v]);
$no = floor($no); if($no <> 1) $pds[$v] .='s'; $x=sprintf("%d %s ",$no,$pds[$v]);
if(($rcs == 1)&&($v >= 1)&&(($cur_tm-$_tm) > 0)) $x .= time_ago($_tm);
return $x;
}
.has-ripple {
position: relative;
overflow: hidden;
@include transition(.4s all);
}
.ripple {
background: #FFF;
position: absolute;
-webkit-animation: ripple 1s cubic-bezier(0.23, 1, 0.32, 1);
animation: ripple 1s cubic-bezier(0.23, 1, 0.32, 1);
cubic-bezier(0.77, 0, 0.175, 1)
myApp.animation('.repeated-items', function() {
return {
enter: function(element, done) {
element.velocity("transition.slideUpIn", {stagger: 100, complete: done});
},
leave: function(element, done) {
element.velocity("transition.shrinkOut", {stagger: 100, complete: done});
},
move: function(element, done) {
element.velocity("transition.slideUpIn", {stagger: 100, complete: done});
package com.example.gpstraker;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.os.IBinder;
var newTodo = todos.add(credentials).then(
function(response) {
$scope.todos.push(response);
console.log(response);
console.log($scope.todos);
$scope.new_desc = "";
}
)