This file contains hidden or 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
const cronstrue = require('cronstrue') | |
// https://github.com/harrisiirak/cron-parser | |
const MONTHS = [null, 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] | |
const DAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'] | |
const dayNum = { | |
sun: '0', | |
mon: '1', | |
tue: '2', | |
wed: '3', |
This file contains hidden or 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
import { ref } from 'vue' | |
const useCronDecoder = () => { | |
const decodeMinutes = (stringDate, time) => { | |
let date = new Date(`${stringDate} ${time}`) | |
let minutes = date.getMinutes(); | |
console.log('minutes: ', minutes) | |
return minutes | |
} |
This file contains hidden or 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
import NodeCache from 'node-cache'; // or 'redis' | |
class CacheService { | |
constructor(ttlSeconds) { | |
// this could also be redis | |
this.cache = new NodeCache({ stdTTL: ttlSeconds, checkperiod: ttlSeconds * 0.2, useClones: false }); | |
} | |
get(key, storeFunction) { |
This file contains hidden or 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
public static class ExpressionBuilder | |
{ | |
private static readonly MethodInfo containsMethod = typeof(string).GetMethod("Contains"); | |
private static readonly MethodInfo toLowerMethod = typeof(string).GetMethod("ToLower", new Type[0] { }); | |
public static Func<T, bool> GetExpression<T>(IList<Filter> filters) | |
{ | |
ParameterExpression parameter = Expression.Parameter(typeof(T), "t"); | |
Expression expression = null; |
This file contains hidden or 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
import { MongoClient } from 'mongodb'; | |
const DbConnection = function () { | |
var db = null; | |
var instance = 0; | |
async function DbConnect() { | |
try { | |
let url = 'mongodb://localhost:27017/articles'; |
This file contains hidden or 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 A String to Base64 String or Vice-Versa | |
*/ | |
declare const android: any; | |
declare const java: any; | |
declare const NSData: any; | |
declare const NSUTF8StringEncoding: any; | |
declare const NSString: any; |
This file contains hidden or 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 A String to Base64 String or Vice-Versa | |
*/ | |
declare const android: any; | |
declare const java: any; | |
declare const NSData: any; | |
declare const NSUTF8StringEncoding: any; | |
declare const NSString: any; |