Skip to content

Instantly share code, notes, and snippets.

View harshamv's full-sized avatar
🏠
Working from home

Harsha MV harshamv

🏠
Working from home
View GitHub Profile
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);
@harshamv
harshamv / gist:18ff6dcbf576636da199cd99f1baea94
Created September 20, 2016 05:17
Nomad Google Maps Js
<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({
@harshamv
harshamv / cakephp-shared-htaccess
Last active August 4, 2020 12:38
CakePHP on GoDaddy Shared Hosting .htaccess settings
#Need to add three .htaccess files as well as configure the database.php file
####### In the root directory
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
@harshamv
harshamv / maps.js
Created May 12, 2015 07:07
Maps Options
<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
/ Form excerpt
= f.button t(".save"), class: "btn"
= f.button t(".publish"), class: "btn", name: "publish"
= f.button t(".test"), class: "btn", name: "test"
@harshamv
harshamv / Commands
Last active August 29, 2015 14:10
Setting up a New Rails App
# Create a new Rails Project
rails new <project-name> -d mysql
# Run Bundler
bundle install
# Database Initiation
rake db:create
# Dump SQL file into MySQL
@harshamv
harshamv / CarrierWave_Settings.rb
Last active August 29, 2015 14:09
CarrierWave Settings
# encoding: utf-8
class DisplayPhotoUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
include CarrierWave::RMagick
include CarrierWave::Processing::RMagick
# include CarrierWave::MiniMagick
include CarrierWave::ImageOptimizer
@harshamv
harshamv / Files.php
Last active August 29, 2015 14:07 — forked from AmyStephen/Files.php
<?php
/**
* File class
*
* @package Molajo
* @copyright 2013 Amy Stephen. All rights reserved.
* @license MIT, GPL v2 or later
*/
namespace Molajo;
<?php
/**
* Convert a comma separated file into an associated array.
* The first row should contain the array keys.
*
* Example:
*
* @param string $filename Path to the CSV file
* @param string $delimiter The separator used in the file
* @return array
@mixin box-shadow($top, $left, $blur, $size, $color, $inset: false) {
@if $inset {
-webkit-box-shadow:inset $top $left $blur $size $color;
-moz-box-shadow:inset $top $left $blur $size $color;
box-shadow:inset $top $left $blur $size $color;
} @else {
-webkit-box-shadow: $top $left $blur $size $color;
-moz-box-shadow: $top $left $blur $size $color;
box-shadow: $top $left $blur $size $color;
}