This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Download Postman | |
cd /tmp || exit | |
echo "Downloading Postman..." | |
wget -q https://dl.pstmn.io/download/latest/linux?arch=64 -O postman.tar.gz | |
# Extract and install Postman to /opt | |
echo "Extracting and installing to /opt..." | |
sudo tar -xzf postman.tar.gz -C /opt/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://gist.github.com/cobyism/4730490 | |
https://medium.com/front-end-hacking/angularjs-github-pages-the-easy-way-7b9568b7b07c | |
https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/ | |
# Git Branch Renaming | |
- https://multiplestates.wordpress.com/2015/02/05/rename-a-local-and-remote-branch-in-git/ | |
# Change older git commits |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ============= Angular-Case-Insensitive-State-Routing ============== */ | |
var app = angular.module('urlRoute', []) | |
.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) { | |
$urlRouterProvider.otherwise('/login'); | |
$urlRouterProvider.rule(function ($injector, $location) { | |
//what this function returns will be set as the $location.url | |
var path = $location.path(), normalized = path.toLowerCase(); | |
if (path != normalized) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* HERE | |
table name is "my_table" | |
\m and \M mark the beginning and end of a word in the regexp match. | |
*/ | |
SELECT n.nspname AS schema_name | |
,p.proname AS function_name | |
,pg_get_function_arguments(p.oid) AS args | |
,pg_get_functiondef(p.oid) AS func_def | |
FROM (SELECT oid, * FROM pg_proc p WHERE NOT p.proisagg) p |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const phoneRegx = RegExp(/^[0]?[789]\d{9}$/) | |
const emailRegx = RegExp( /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/) | |
let phoneNumber = '9999999999' | |
let email = 'a@gmail.com' | |
console.log('PHONE REGX:= ', phoneRegx.test(phoneNumber)); | |
console.log('EMAIL REGX:= ', emailRegx.test(email)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT ele->>'partCode' FROM json_array_elements('[{"partCode": "sdvsv", "partName": "sdvfv", "problemCatagory": "Dock Related"}]'::json) AS ele |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE my_table(col text, col2 text) | |
/* SELECT DATA FROM JSON */ | |
SELECT * FROM json_each('{"a":"foo", "b":"bar"}') AS e | |
/* INSERT INTO TABLE */ | |
INSERT INTO my_table(col, col2) | |
SELECT * FROM json_to_record('{"a":"foo", "b":"bar"}') AS x(col text, col2 text) -- as can have different column name | |
SELECT * FROM my_table |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.9.0/underscore-min.js"></script> | |
<body> | |
<div ng-app="myApp" ng-controller="myCtrl"> | |
<div ng-repeat="item in myArr" class="form-group row"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd /tmp || exit | |
echo "Downloading sonar-scanner....." | |
if [ -d "/tmp/sonar-scanner-cli-4.7.0.2747-linux.zip" ];then | |
sudo rm /tmp/sonar-scanner-cli-4.7.0.2747-linux.zip | |
fi | |
wget -q https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.7.0.2747-linux.zip | |
echo "Download completed." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
pg_terminate_backend(pid) | |
FROM | |
pg_stat_activity | |
WHERE | |
-- don't kill my own connection! | |
pid <> pg_backend_pid() | |
-- don't kill the connections to other databases | |
AND datname = '<db-name-here>'; |
OlderNewer