Skip to content

Instantly share code, notes, and snippets.

@vmohir
vmohir / inject-script.js
Created December 9, 2020 16:39
SoundCloud useful buttons
function docReady(fn) {
if (
document.readyState === "complete" ||
document.readyState === "interactive"
) {
setTimeout(fn, 1);
} else {
document.addEventListener("DOMContentLoaded", fn);
}
}
@vmohir
vmohir / jalali-date.ts
Last active November 19, 2020 15:56
Angular Material Jalali Date Adapter
export class JalaliDate {
static parse(value: string, parseFormat: string | string[]) {
const [year, month, day] = value.split('/');
return new JalaliDate(parseInt(year, 10), parseInt(month, 10), parseInt(day, 10));
}
constructor(public year: number, public month: number, public day: number) {}
clone(): JalaliDate {
return new JalaliDate(this.year, this.month, this.day);
}
isValid() {
@vmohir
vmohir / real-shuffle.js
Last active September 19, 2020 06:46
SoundCloud Better Shuffle
/**
* This script adds a button to soundcloud web that will simulate a scroll to the playlist and finally shuffles it.
* This way, it'll shuffle all the musics
*/
function docReady(fn) {
if (
document.readyState === "complete" ||
document.readyState === "interactive"
) {
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"printWidth": 140,
"htmlWhitespaceSensitivity": "ignore",
"useTabs": false,
"quoteProps": "as-needed",
"bracketSpacing": true,
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"@api/*": ["app/api/*"],
"@components/*": ["app/components/*"],
"@dialogs/*": ["app/dialogs/*"],
"@constants/*": ["app/constants/*"],
"@directives/*": ["app/directives/*"],
@vmohir
vmohir / cloudSettings
Last active November 26, 2020 16:28
vscode settings
{"lastUpload":"2020-11-26T16:28:09.723Z","extensionVersion":"v3.4.3"}
@vmohir
vmohir / gulpfile.js
Created September 16, 2019 15:27
## Simple gulpfile.js Simple gulpfile.js that minifies everything and also uses autoprifixer and imagemin ### Usage - Put every file in `src` folder. - Download the `package.json` and `gulpfile.js` provided in comments below and copy them beside t
var gulp = require('gulp'),
del = require('del'),
uglify = require('gulp-uglify'),
minifyCSS = require('gulp-minify-css'),
imagemin = require('gulp-imagemin'),
autoprefixer = require('gulp-autoprefixer'),
plumber = require('gulp-plumber'),
htmlmin = require('gulp-htmlmin'),
cache = require('gulp-cache');
@vmohir
vmohir / settings.txt
Last active September 12, 2019 10:26
surfing keys chrome extension settings
unmap("d");
unmap("R");
unmap("E");
unmap("e");
unmap("x");
unmap("gg");
unmap("j");
unmap("/");
unmap("n");
unmap("r");
@vmohir
vmohir / u.bash
Created September 5, 2019 08:07
clone git repo with a specific user:pass
git remote set-url origin https://name:password@github.com/repo.git
@mixin svg-icon($icon_name) {
width: 16px;
display: inline-block;
&:before {
background: url('/assets/svg/#{$icon_name}');
content: '';
background-size: contain;
padding-bottom: 100%;
display: block;
}