View request.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
/** | |
* Axios Request Wrapper | |
* --------------------- | |
* | |
* @author Sheharyar Naseer (@sheharyarn) | |
* @license MIT | |
* | |
*/ | |
import axios from 'axios' |
View grunt watch with http server setup.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
module.exports = function( grunt ) { | |
grunt.initConfig({ | |
'http-server': { | |
'dev': { | |
root: "..", | |
port: 8080, | |
host: "0.0.0.0", | |
cache: 0, |
View selection_sort.rb
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
def selection_sort array | |
(array.length-1).times do |i| | |
minindex = i | |
minvalue = array[i] | |
(i).upto(array.length-1) do |j| | |
if array[j] < minvalue | |
minindex = j | |
minvalue = array[j] | |
end |
View bubble_sort.rb
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
def bubble_sort array | |
(array.length-1).times do |i| | |
(array.length-1-i).times do |j| | |
if array[j] > array[j+1] | |
array[j], array[j+1]=array[j+1], array[j] | |
end | |
end | |
end | |
array | |
end |
View rake_for_postgres_s3_backup
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
#First you have add the following gems to your Gemfile | |
gem 'aws-sdk', '< 2.0' | |
gem 'zip' | |
gem 'whenever' | |
#Created a new file at lib/tasks/backup.rake and add the following | |
desc "PG Backup" | |
namespace :pg do | |
task :backup => [:environment] do |
View db.go
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
package main | |
import ( | |
"database/sql" | |
"fmt" | |
_ "github.com/lib/pq" | |
) | |
const ( | |
DB_USER = "ramesh" |
View godlist
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
RAILS_ROOT = File.expand_path('../', __dir__) | |
def default_process_monitoring(w, w.name) | |
# determine the state on startup | |
w.transition(:init, { true => :up, false => :start }) do |on| | |
on.condition(:process_running) do |c| | |
c.running = true | |
end | |
end |
View select2 ajax example with formated result
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
$("#selector").select2({ | |
width: "200px", | |
placeholder: "Search for a item", | |
minimumInputLength: 3, | |
ajax: { | |
url: "/url", | |
dataType: "json", | |
data: function(term, page) { | |
return { | |
q: term, |