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 / gist:8af8d878fc55629e7804e3e9ab2e1263
Last active June 27, 2017 21:36
Creditcard Validation AMEX is not accepted: This validation is in the 4th input box in the credit card input form. Will show error msg when the user input 3 numbers in the 4th input box.
$(document).ready(function() {
var cc_4 = $("input[name='cc_4']");
cc_4.blur( function() { // DEV-599
if ( (cc_4.val().length) == 3 ) {
var no_amex = "Sorry American Express is not accepted.";
if ( $('#cc_number-E').length ) {
@jericrealubit
jericrealubit / readme.md
Created June 30, 2017 05:18 — forked from nasrulhazim/readme.md
Send Welcome Email Notification with Event and Listener

Send Welcome Email Notification with Event and Listener

Step 1

Create SendWelcomeEmailNotification notification

php artisan make:notification SendWelcomeEmailNotification
@jericrealubit
jericrealubit / rabbitmq.txt
Created September 13, 2017 20:49 — forked from sdieunidou/rabbitmq.txt
create admin user on rabbitmq
rabbitmqctl add_user test test
rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
@jericrealubit
jericrealubit / gist:3ecf16c698dc411e291a09b0fb2d9342
Created September 13, 2017 20:56
The then() method returns a Promise. It takes up to two arguments: callback functions for the success and failure cases of the Promise.
authService.login = function(credentials) {
// we need this to return a promise but we also want to hook into the promise.
return ApiInterface.makeRequest('/api/auth', 'POST', credentials)
.then( function(response) { // success
Session.setAuthToken(response.data.authToken);
Session.initDataStore('order-details', credentials);
$rootScope.$emit(AUTH_EVENTS.loginSuccess);
})
.catch( function(error) { // failed
@jericrealubit
jericrealubit / gist:55cfc0f447c8587fb3c4e31b3b1335c4
Created September 13, 2017 20:56
The then() method returns a Promise. It takes up to two arguments: callback functions for the success and failure cases of the Promise.
authService.login = function(credentials) {
// we need this to return a promise but we also want to hook into the promise.
return ApiInterface.makeRequest('/api/auth', 'POST', credentials)
.then( function(response) { // success
Session.setAuthToken(response.data.authToken);
Session.initDataStore('order-details', credentials);
$rootScope.$emit(AUTH_EVENTS.loginSuccess);
})
.catch( function(error) { // failed
<?php
require_once __DIR__ . '/vendor/autoload.php';
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;
$connection = new AMQPStreamConnection('jeric.devel.nz', 5672, 'guest', 'guest');
$channel = $connection->channel();
$channel->queue_declare('hello', false, false, false, false);
<?php
require_once __DIR__ . '/vendor/autoload.php';
use PhpAmqpLib\Connection\AMQPStreamConnection;
$connection = new AMQPStreamConnection('jeric.devel.nz', 5672, 'guest', 'guest');
$channel = $connection->channel();
$channel->queue_declare('hello', false, false, false, false);
@jericrealubit
jericrealubit / questions.md
Created November 9, 2017 23:59 — forked from sudomabider/questions.md
Interesting coding questions

What will it be?

Javascript

// Without running these in the browser, can you tell what each of the following would return?
['1', '2', '3', '4'].map(parseInt);

(new Array(2)).map(function() {
 return 1;
@jericrealubit
jericrealubit / chkASCII32_126.js
Created March 22, 2018 20:29
Validate an input string if it is inside ASCII 32 - 126 range
/**
* Validate an input string if it is inside ASCII 32 - 126 range
* @param string
* @return true if all characters in the string are in range, else false
*/
var chkASCII32_126 = function(string) {
return !string.match(/[^\x20-\x7e]/g);
}
$(".chorusASCIIValidation").keyup(function() {
@jericrealubit
jericrealubit / docker-image-size.sh
Created April 19, 2018 02:20 — forked from andyrbell/docker-image-size.sh
Sort docker images by size desc
#!/bin/sh
docker images --format '{{.Size}}\t{{.Repository}}\t{{.Tag}}\t{{.ID}}' | sed 's/ //' | sort -h -r