Skip to content

Instantly share code, notes, and snippets.

Pasindu Perera udnisap

Block or report user

Report or block udnisap

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View index.html
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
let data = [1,10,4,5,3,5,1,4,5];
<script type="text/javascript" src=""></script>
View React Redux SWAPI
a) Create a simple ReactJS front end in JS Fiddle using the Star Wars API
b) List all the films in first page
c) List all the Characters in a film when you click on a film
d) Bonus points if you use React with Redux/Flux
e) Make sure your front end is responsive
View gist:9f5b6865cb3317e5b208e36f07170512
// main function
customers = readFile('customer.dat');
prefCustomers = readFile('preffrred.dat')
orders = readFile('orders.dat')
for (order in orders){
customer = order.getCustomer();
subtotal = order.calcuateTotal();
currentAmountSpent = customer.getAmountSpent;
View gist:d82f40b3066af5e3f22a763d5ce317c8
# To Display disk mapping
# Erase the disk with random strings
dd if=/dev/urandom of=/dev/null status=progress
View Concurrency.js
const API = '';
// Data Fetching and Logic
const getData = (endpoint) =>
.then(resp => resp.json());
const findUserByUserName = (username) =>
udnisap / rate_limit.js
Last active Nov 9, 2019 — forked from epogue/rate_limit.js
This will make sure(most of the times) the concurrent invocation is handled
View rate_limit.js
/* Extend the Underscore object with the following methods */
// Rate limit ensures a function is never called more than every [rate]ms
// Unlike underscore's _.throttle function, function calls are queued so that
// requests are never lost and simply deferred until some other time
// Parameters
// * func - function to rate limit
// * rate - minimum time to wait between function calls
// * async - if async is true, we won't wait (rate) for the function to complete before queueing the next request
View dbDump.php
$tables = array ();
$result = mysqli_query ( $con, 'SHOW TABLES' );
while ( $row = mysqli_fetch_array ( $result ) ) {
$tables [] = $row [0];
// cycle through the tables
foreach ( $tables as $table ) {
View PageObject
var codeTemplate = '\
<ul class="people_list"> \
{{#each people}} \
<li>{{this}}</li> \
{{/each}} \
</ul> \
udnisap / xPathGetter
Last active Aug 29, 2015
View xPathGetter
if (typeof xpathGetter === 'undefined') {
xpathGetter = function(){
var isActive = false,
mode = "XPATH";//0 - xpath, 1-css, 2-id
version = "0.1",
codeTemplate = null,
iniatilized = false;
var pub = {};
var self = {
You can’t perform that action at this time.