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
<?php | |
use Illuminate\Support\Facades\Schema; | |
/** | |
* Trait WithEmptyRecord | |
* Use to get an empty version of an eloquent model | |
* (contains all the column names with empty values (or default values specified by the $attributes array) ) | |
*/ | |
trait WithEmptyRecord{ | |
public static function emptyRecord(){ |
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
<template> | |
<div class="speech-bubble mt-16"> | |
<a | |
:href="`https://twitter.com/search?q=${url}`" | |
target="_blank" | |
class="block no-underline text-blue-500" | |
> | |
<font-awesome-icon :icon="['fab', 'twitter']" /> | |
Discuss on Twitter | |
</a> |
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
// Imports | |
const firestoreService = require('firestore-export-import') | |
const firebaseConfig = require('./src/config/firebase.js') | |
const serviceAccount = require('./serviceAccount.json') | |
const fs = require('fs') | |
const tempFileName = `${__dirname}/data-temp.json`; | |
// procedure | |
(async () => { | |
const fileContents = fs.readFileSync(`${__dirname}/src/data.json`, 'utf8') |
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
See images in comments below |
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
see screenshots in comment below |
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
see screenshots in comments below |
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
export const ucFirst = (string)=>{ | |
if (typeof string !== 'string') return '' | |
return string.charAt(0).toUpperCase() + string.slice(1) | |
} | |
export const ucWords = (string) =>{ | |
if (typeof string !== 'string') return '' | |
return string.split(' ').map(word => ucFirst(word)).join(' ') | |
} |
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
import {ucFirst, snakeCase, camelCase, sentenceCase, ucWords, titleCase, nestedFromDot} from '~/helper/string' | |
describe('string helper functions', ()=>{ | |
test('ucFirst capitalizes the first letter in a string', ()=>{ | |
expect(ucFirst('hello world')).toBe('Hello world') | |
}) | |
test('ucWords capitalizes the first letter in each word of a string', ()=>{ | |
expect(ucWords('hello world')).toBe('Hello World') | |
}) |
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
/** | |
* docs: /docs/cache.md | |
*/ | |
import LZUTF8 from 'lzutf8' | |
window.LZUTF8 = LZUTF8 | |
let cache = { 'default': {} } | |
try{ | |
cache = JSON.parse( LZUTF8.decompress(localStorage.getItem('app_cache'), {inputEncoding: 'StorageBinaryString'}) ) | |
Object.keys(cache).forEach(groupName =>{ |
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
import Cache from '~/helper/Cache' | |
describe('Cache class', ()=>{ | |
test('get method retrieves items from the cache', ()=>{ | |
const cache = new Cache() | |
cache.put('hello', 'world') | |
expect(cache.get('hello')).toBe('world') | |
}) | |
test('put method adds items to the cache', ()=>{ | |
(new Cache).put('hello', 'world') |