Skip to content

Instantly share code, notes, and snippets.

@izifortune
izifortune / rename-color.js
Created Jan 24, 2019
Rename brand colors from SCSS variables to custom color function
View rename-color.js
const { writeFileSync, readFileSync, readdirSync, statSync } = require('fs');
const { join } = require('path');
function isExt(filepath, ext) {
return filepath.endsWith(ext);
}
function walkDir(dir, ext, callback) {
readdirSync(dir).forEach( f => {
let dirPath = join(dir, f);
@izifortune
izifortune / utils.js
Created Jan 18, 2018
nrwl libs utils
View utils.js
const fs = require('fs');
const path = require('path');
const { exec } = require('child_process');
const { parseFiles } = require('@nrwl/schematics/src/command-line/shared');
const { affectedApps } = require('@nrwl/schematics/src/command-line/affected-apps');
const {
readdir
} = require('fs-extra');
View libs-publish.js
const { readdir } = require('fs-extra');
const { pexec } = require('./utils');
const publishLibs = async (dirs) => {
for (let dir of dirs) {
const publishResult = await pexec(`npm publish @common/${dir}`);
}
}
@izifortune
izifortune / libs-test.js
Last active Jan 18, 2018
Nrwl libs test
View libs-test.js
const { getAffectedLibs, pexec } = require('./utils');
const libs = getAffectedLibs();
(async () => {
try {
await pexec(`node ./node_modules/.bin/jest ${libs.join(' ')}`)
} catch (e) {
console.error(e);
}
})();
@izifortune
izifortune / libs-build.js
Last active Jan 18, 2018
nrwl libs build
View libs-build.js
const { getAffectedLibs, pexec } = require("./utils");
const buildLibs = async (apps, rest) => {
if (apps.length > 0) {
console.log("Building " + apps.join(', '));
for (app of apps) {
await pexec("./node_modules/.bin/ng-packagr -p libs/" + app + "/package.json", { stdio: [0, 1, 2]});
}
}
else {
@izifortune
izifortune / libs-affected.js
Last active Jan 18, 2018
nrwl libs affected
View libs-affected.js
const { getAffectedLibs } = require('./utils');
const libs = getAffectedLibs();
console.log(libs.join(' '));
View subtitles.sh
#!/bin/bash
torrentid=$1
torrentname=$2
torrentpath=$3
files=($( ls $torrentpath | grep "mp4\|mkv" ))
for i in ${files[@]}:
do
View sample.service.nobed.spec.ts
import { Observable } from 'rxjs';
import { SampleService } from './sample.service';
const mockAirports = {
DUB: { name: 'Dublin' },
WRO: { name: 'Wroclaw' },
MAD: { name: 'Madrid' }
};
describe('Service: SampleService no TestBed', () => {
View sample.service.bed.spec.ts
import { TestBed, inject } from '@angular/core/testing';
import {
HttpClientTestingModule,
HttpTestingController
} from '@angular/common/http/testing';
import {
HttpClient,
} from '@angular/common/http';
import { SampleService } from './sample.service';
@izifortune
izifortune / kindle_bulk_delete
Created Jun 11, 2017
Select first 10 docs and click delete button
View kindle_bulk_delete
$('.contentTableList_myx .tab_myx a').slice(0, 10).toArray().forEach(el => $(el).trigger('click'));
$('#contentAction_delete_myx > div > a > span > button').trigger('click')
You can’t perform that action at this time.