Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Olaolu Olawuyi whizkydee

🏠
Working from home
View GitHub Profile
View is-within-origin.ts
export function isWithinOrigin(url: any, origin: string) {
try {
const {origin: derivedOrigin} = new URL(url);
if (derivedOrigin === origin) {
return true;
}
return false;
} catch {
return false;
}
View jsconfig.json
{
"compilerOptions": {
"target": "esnext",
"baseUrl": "./",
"paths": {
"@/*": ["src/*"]
}
},
"exclude": ["node_modules"]
}
@whizkydee
whizkydee / git-pushing-multiple.rst
Created Sep 2, 2019 — forked from rvl/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.
View git-pushing-multiple.rst

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

View loose-equal.js
function isObject(obj) {
return obj !== null && typeof obj === 'object'
}
export default function looseEqual(a, b) {
if (a === b) return true
const isObjectA = isObject(a)
const isObjectB = isObject(b)
if (isObjectA && isObjectB) {
try {
@whizkydee
whizkydee / country-dial-codes.json
Created Apr 27, 2019
Country Dial Codes JSON data (Extracted from Gmail)
View country-dial-codes.json
[
{ "label": "+93", "value": "Afghanistan" },
{ "label": "+355", "value": "Albania" },
{ "label": "+213", "value": "Algeria" },
{ "label": "+1", "value": "American Samoa" },
{ "label": "+376", "value": "Andorra" },
{ "label": "+244", "value": "Angola" },
{ "label": "+1", "value": "Anguilla" },
{ "label": "+1", "value": "Antigua & Barbuda" },
{ "label": "+54", "value": "Argentina" },
@whizkydee
whizkydee / InputGroup.js
Last active May 4, 2019
HelloTax InputGroup v2
View InputGroup.js
import Vue from 'vue'
const InputGroup = Vue.component('InputGroup', {
render() {
const {
type,
full,
name,
icon,
@whizkydee
whizkydee / TopBar.js
Last active May 4, 2019
Super React-y component in Vue
View TopBar.js
import Vue from 'vue'
import { mapState } from 'vuex'
import StyledTopBar from './styles'
import { Button } from '@/HelloTaxUI'
import { NavItem } from '../Navigation'
import { UserService } from '@/services'
import 'flag-icon-css/css/flag-icon.min.css'
import Notifications from '@/components/Notifications'
import { BellIcon, Cog, LogoutIcon } from '@/assets/icons'
View snippet.js
handleUpload = event => {
const imgElem = this.imgRef.current;
const file = event.target.files[0];
if (file && file.type.startsWith('image/')) {
imgElem.file = file;
const form = new FormData();
form.append('files', file);
@whizkydee
whizkydee / svgToCanvas.js
Created Oct 24, 2018
WIP to write SVG data to Canvas
View svgToCanvas.js
import React from 'react';
import Store from '../store';
import EventBus from '../eventBus';
import Selection from './selection';
import { getShapeRect } from '../utils';
import { renderToStaticMarkup } from 'react-dom/server.browser';
export default class WhiteBoard extends React.Component {
constructor() {
super();
@whizkydee
whizkydee / ffmpeg.md
Created Jul 17, 2018 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files
View ffmpeg.md

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz: