Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Super-Chama's full-sized avatar
🍊
Back to office

Chamara Abesinghe Super-Chama

🍊
Back to office
View GitHub Profile
@Super-Chama
Super-Chama / stats.js
Created July 19, 2023 05:50
Analyse all ES6 imports inside directory
const fs = require("fs");
const path = require("path");
const glob = require("glob");
function traverseAndWriteImports(directory, outputFile) {
const filePattern = path.join(directory, "**/*.{js,ts}");
const files = glob.sync(filePattern, {
ignore: "**/node_modules/**",
nodir: true,
});
const faker = {
name: {
firstName() {
// array containing 100 random first names
const firstNames = [
"Tim",
"John",
"Jane",
"Jack",
"Jill",
class SuppressWarningsPlugin {
warning;
maxWarnings;
constructor(maxWarnings = 0) {
this.maxWarnings = maxWarnings;
}
apply(compiler) {
compiler.hooks.emit.tap("SuppressWarningsPlugin", (compilation) => {
if (!Array.isArray(compilation.warnings)) return;
@Super-Chama
Super-Chama / counter.controller.js
Created March 3, 2023 04:32
Basic Vuex (Flux) pattern for Angular.js (1x)
(function () {
"use strict";
angular.module("app").controller("CounterController", CounterController);
CounterController.$inject = ["$scope", "storeService"];
function CounterController($scope, storeService) {
var vm = this;

1.X Folder structure

├── components
│   ├── package.json
│   └── src
│       ├── core
│       │   └── components
│       │      └── Alert
│       │         ├── alert.scss
│       │         ├── Alert.vue
@Super-Chama
Super-Chama / autoshutdown.sh
Created January 1, 2023 19:41
Shell script to schedule shutdown if web service is not reachable
#!/bin/bash
IP='192.168.1.1'
DELAY=5
DATE=$(date '+%d/%m/%Y %H:%M:%S')
ping -c 1 $IP &> /dev/null
if [[ $? -ne 0 ]];
then
@Super-Chama
Super-Chama / blob.svg
Created June 15, 2022 11:37
OrangeHRM Dark Theme
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<?php
/**
* OrangeHRM is a comprehensive Human Resource Management (HRM) System that captures
* all the essential functionalities required for any enterprise.
* Copyright (C) 2006 OrangeHRM Inc., http://www.orangehrm.com
*
* OrangeHRM is free software; you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.

Check latest changes
git fetch upstream

Switch to latest 5.2 branch
git checkout upstream/5.2

Create and switch to your local branch
replace [JIRA_ID] with your ticket ID
git checkout -b [JIRA_ID]

// Based on a field value, show some extra input fields
const schemaOne = {
layout: [
{
type: 'grid',
props: {
cols: 2,
},
children: {