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
$this->validate($request, [ | |
'phone' => 'required|digits:10' | |
]); | |
$this->validate($request, [ | |
'phone' => 'required|numeric|between:9,11' | |
]); | |
$this->validate($request, [ | |
'phone' => 'required|min:10|numeric' |
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
this.$svgCircle = document.querySelector("circle"); | |
this.circumference = 2 * Math.PI * this.$svgCircle.getAttribute("r"); | |
setCircleProgress(amount) { | |
let res = amount * this.circumference / 100 + ", " + this.circumference; | |
this.$svgCircle.setAttribute("stroke-dasharray", res) | |
} |
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
// ========================================================================== | |
// ReleaseDownload Progress Bar | |
// ========================================================================== | |
import AbstractObject from './AbstractObject'; | |
export default class ReleaseDownload extends AbstractObject { | |
constructor(el, options) { | |
super(el, options); | |
this.el = el; |
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
/* | |
|-------------------------------------------------------------------------- | |
| Tailwind configuration | |
|-------------------------------------------------------------------------- | |
*/ | |
const mix = require('laravel-mix'); | |
const tailwindcss = require('tailwindcss') | |
mix.js('resources/frontend/scripts/app.js', 'public/js/app.js'); |
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
#!/usr/bin/env node | |
const puppeteer = require('puppeteer'); | |
/** | |
* npm link/savepage url=https://stackoverflow.com/ | |
* Margins default to Microsoft Word A4 margins. | |
*/ | |
class SavePage { |
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
function combinations(n) { | |
if (n < 0) { | |
return 0; | |
} else if (n < 3) { | |
return n; | |
} | |
return n * (n - 1) * (n - 2); | |
} | |
console.log(combinations(8)) // (8 - 1 = 7) * (8 - 2 = 6) = (42 * 8) = 336 |
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
// https://dev.to/coderbyte/a-javascript-interview-question-asked-at-facebook-27po | |
var el = document.getElementById("myDiv"); | |
function animate(el, totalTime, distance, startTime, position) { | |
if (position >= distance) return; | |
var expired = (new Date() - startTime) / 1000; | |
position = expired * distance / totalTime * 1000; |
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
// Web Dev Simplified | |
// 8 Must Know JavaScript Array Methods | |
// https://www.youtube.com/watch?v=R8rmfD9Y5-c | |
const items = [ | |
{ name: 'Bike', price: 100 }, | |
{ name: 'TV', price: 200 }, | |
{ name: 'Album', price: 10 }, | |
{ name: 'Book', price: 5 }, | |
{ name: 'Phone', price: 500 }, |
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
// Thoroughly untested. | |
let searchTerms = ['law', 'software', 'news', 'health']; | |
let elems = document.querySelectorAll("h1, h2, h3, h4, h5, h6, li, p, a") | |
for (let i = 0, total = elems.length; i < total; i++) { | |
let element = elems[i]; | |
if (element && element.innerText) { | |
let innerText = element.innerText; | |
for (let j = 0; j < searchTerms.length; j++) { |
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 RAFEngine from 'raf-engine'; | |
const engine = new RAFEngine(); | |
export default (ctx, inject) => { | |
ctx.$engine = engine; | |
inject('engine', engine); | |
} |