Skip to content

Instantly share code, notes, and snippets.

View firdoussross's full-sized avatar

Firdouss Ross firdoussross

View GitHub Profile
@firdoussross
firdoussross / file-upload.component.html
Created April 30, 2020 15:30
ngx-file-upload example with <input type="file">
<div class="border rounded bg-light p-5">
<form class="form mb-0">
<div class="form-group">
<p><strong>Select files to upload:</strong></p>
<div class="custom-file">
<input type="file" class="custom-file-input" id="customFile" ngxFileSelect [uploader]="uploader" multiple>
<label class="custom-file-label" for="customFile">Choose file</label>
</div>
</div>
@firdoussross
firdoussross / .travis.yml
Created April 29, 2020 09:23
Travis-CI configuration for running Chrome with Karma
language: node_js
node_js:
- "10"
services:
- xvfb
before_install:
- export CHROME_BIN=google-chrome-stable
#!/bin/bash
DEPLOY_DIR=/var/www/public_html
# Get the version from package.json
PACKAGE_VERSION=$(grep version ../package.json \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g' \
| tr -d '[:space:]')

Useful commands that I always tend to forget.

BASH

Zip all folders individually to it's own archives

$ for dir in *; do tar -czf ${dir}.tar.gz ${dir}; done

MySQL

[
{"name": "Afghanistan", "code": "AF"},
{"name": "Åland Islands", "code": "AX"},
{"name": "Albania", "code": "AL"},
{"name": "Algeria", "code": "DZ"},
{"name": "American Samoa", "code": "AS"},
{"name": "AndorrA", "code": "AD"},
{"name": "Angola", "code": "AO"},
{"name": "Anguilla", "code": "AI"},
{"name": "Antarctica", "code": "AQ"},
// Experimental : Detect background color brightness and change the font color accordingly
$(".subject-icon").each(function() {
var isBright = (parseInt(get_brightness(rgb2hex($(this).css("background-color")))) > 160);
if (!isBright) $(this).addClass('subject-icon-dark');
});
// Check color brightness
// returns brightness value from 0 to 255
// http://www.webmasterworld.com/forum88/9769.htm
function get_brightness(hexCode) {