Skip to content

Instantly share code, notes, and snippets.

View jericrealubit's full-sized avatar
🎯
Focusing

jeric realubit jericrealubit

🎯
Focusing
View GitHub Profile
@jericrealubit
jericrealubit / docker-prune.sh
Last active April 19, 2018 04:16
docker system cleanup
#!/bin/bash
#check disk space
df -h
#check dangling volume
docker volume ls -qf dangling=true
docker system prune -a --volumes
@jericrealubit
jericrealubit / datatable-alternate-stripes
Last active May 28, 2018 22:30
datatables alternate stripes
///+ Service Type Stripe
var cnt = 0;
$('td:first-child').each(function() {
if ($(this).text() != '') {
cnt++;
if (cnt % 2 == 0) {
var oTR = $(this).parent();
if (oTR.attr('class') == 'odd') {
var nx = oTR.css('background-color','#faf6e6');
@jericrealubit
jericrealubit / Acceptance.php
Created June 7, 2018 23:10 — forked from SimonEast/Acceptance.php
Codeception - how to test for redirects
<?php
// Simply place the following two functions in _support/Helper/Acceptance.php
// Then you can call $I->verifyRedirect(...) inside your tests
namespace Helper;
class Acceptance extends \Codeception\Module
{
/**
* Ensure that a particular URL does NOT contain a 301/302
@jericrealubit
jericrealubit / arrayToCSV.js
Created November 12, 2018 02:59 — forked from yangshun/arrayToCSV.js
Converts a 2D array into a CSV file
function arrayToCSV (twoDiArray) {
// Modified from: http://stackoverflow.com/questions/17836273/
// export-javascript-data-to-csv-file-without-server-interaction
var csvRows = [];
for (var i = 0; i < twoDiArray.length; ++i) {
for (var j = 0; j < twoDiArray[i].length; ++j) {
twoDiArray[i][j] = '\"' + twoDiArray[i][j] + '\"'; // Handle elements that contain commas
}
csvRows.push(twoDiArray[i].join(','));
}
@jericrealubit
jericrealubit / countSameLetterInWord.js
Last active March 1, 2024 06:20
count the word that have at least 1 same letter from other word in the sentence
// count the word that have at least 1 same letter from other word in the sentence,
// will check letters only special characters will be ignored
function countSameLetterInWord(sentence) {
// remove special characters from the input
let input = sentence.replace(/[^a-zA-Z ]/g, "");
//console.log(input);
let words = input.split(" ");
let tempWords;
let tempLetter;