Skip to content

Instantly share code, notes, and snippets.

View narenaryan's full-sized avatar
🏠
Dreaming Big

N3N9 narenaryan

🏠
Dreaming Big
View GitHub Profile
@narenaryan
narenaryan / excel_dump.js
Last active July 4, 2016 07:47
This is a snippet to make a post request to get excel file from server
$("#my-button").on("click", function(){
// Data to post
data = {
ids: [1, 2, 3, 4, 5]
};
// Use XMLHttpRequest instead of Jquery $ajax
xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
<html><head>
<link rel="stylesheet" href="css/materialize.min.css">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="white-container">
<div class="inner-content">
<div class="card-image">
<img src="img/Navbar.jpg" class="nav-image">
@narenaryan
narenaryan / spa2.js
Last active November 12, 2016 04:29
// Angular JS code
var app = angular.module('website', [])
app.service('dataService', function() {
this.UIData = {
BorderedTable: [[
"index.html",
1266,
32.3 % ,
321.33
], [
@narenaryan
narenaryan / spa1.js
Last active November 12, 2016 03:32
// Angular JS code
angular.module('website', []).
controller('MainController', function($scope) {
// It is an array of object{Page, Visits, PerNewVisits,Revenue}
$scope.BorderedTable = [["index.html", 1266, 32.3%, 321.33],
["about.html", 261, 33.3%, 234.12]];
$scope.BorderedWithStrippedTable = [["index.html", 1266, 32.3%, 321.33],
["about.html", 261, 33.3%, 234.12]];
@narenaryan
narenaryan / spa3.js
Last active November 12, 2016 04:48
app.controller('MainController', function($scope, $http, dataService) {
$scope.data = dataService.UIData;
$scope.addBorderedTableRow = function(data) {
$scope.data.BorderedTable.push(data);
var req = {
method: 'POST',
url: 'http://posturl',
headers: {
'Content-Type': "application/json"
@narenaryan
narenaryan / app.js
Created November 25, 2016 09:51
Angular JS implementation of Bootstrap Select
var app = angular.module('sampleApp');
// add this directive to your app
app.directive( 'bootstrapSelect', [function() {
return {
restrict: 'A',
link: function( scope, elem, attrs ) {
elem.ready(function(){
@narenaryan
narenaryan / gulpfile.js
Created February 7, 2017 02:40
A sample gulp file with minifies and watchers
var gulp = require("gulp");
var minifyHtml = require("gulp-minify-html");
var minifyCss = require("gulp-minify-css");
var uglify = require("gulp-uglify");
var concat = require("gulp-concat");
var paths = {
scripts: "src/js/*.js",
styles: "src/css/*.css",
html: "src/*.html"
package main
import (
"github.com/gorilla/mux"
"log"
"net/http"
"time"
"fmt"
)
package main
import (
"fmt"
"html"
"log"
"net/http"
"os"
"time"
)
var gulp = require("gulp");
var shell = require('gulp-shell');
// This compiles new binary with source change
gulp.task("install-binary", shell.task([
'go install github.com/narenaryan/myserver'
]));
// Second argument tells install-binary is a deapendency for restart-supervisor
gulp.task("restart-supervisor", ["install-binary"], shell.task([