View gist:71ffe07793fdfca621dbf4bec3e01ca7
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
let counter = 0; | |
function doSomethingAsync(id, start) { | |
return new Promise(resolve => { | |
setTimeout(() => { | |
counter++; | |
const stop = new Date(); | |
const runningTime = getSeconds(start, stop); | |
resolve(`result${id} completed in ${runningTime} seconds`); | |
}, 2000); |
View gist:18ff6dcbf576636da199cd99f1baea94
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
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBkg1vwaBHSPzbhrQoyThpxYmZF24Py-ok"></script> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$("#venue_country_id").change(function(){ | |
var country_id = $(this).val(); | |
console.log(country_id); | |
$.ajax({ |
View 0_reuse_code.js
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
View Gemfile
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
source 'https://rubygems.org' | |
ruby "2.0.0" | |
gem 'rails', github: 'rails/rails' | |
gem 'arel', github: 'rails/arel' | |
... |
View random_password.php
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
// Random Password Generator | |
function _RandomPasswordGenerator() { | |
// Create the meta-password | |
$sMetaPassword = ""; | |
$CONFIG['security']['password_generator'] = array("C" => array('characters' => | |
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'minimum' => 4, | |
'maximum' => 6), "S" => array('characters' => "!@()-_=+?*^&", 'minimum' => 0, | |
'maximum' => 0), "N" => array('characters' => '1234567890', 'minimum' => 2, | |
'maximum' => 2)); |
View url_slug.php
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
// Creates a URL Slug | |
function _url_slug($string) { | |
$string = strtolower(trim($string)); | |
$string = preg_replace('/[^a-z0-9-]/', '-', $string); | |
$string = preg_replace('/-+/', "-", $string); | |
return $string; | |
} | |
// Gets a Unique slug string by checking in the database |
View UUID_Generator.php
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
//UUID generator | |
function _imgName() { | |
return time() . substr(md5(microtime()), 0, 12); | |
} |
View maps.js
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
<script type="text/javascript"> | |
var map; | |
var geocoder; | |
var service; | |
var mapOptions = { | |
center: new google.maps.LatLng(12.971599, 77.594563), | |
zoom: 14, | |
mapTypeId: google.maps.MapTypeId.ROADMAP |
View 1.form.html.haml
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
/ Form excerpt | |
= f.button t(".save"), class: "btn" | |
= f.button t(".publish"), class: "btn", name: "publish" | |
= f.button t(".test"), class: "btn", name: "test" |
NewerOlder