Skip to content

Instantly share code, notes, and snippets.

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

Harish Kotra harishkotra

🏠
Working from home
View GitHub Profile
@sochix
sochix / app.js
Last active August 9, 2024 07:01
Counting requests in your Node.js+Express application
const app = require('express')()
const getRoute = (req) => {
const route = req.route ? req.route.path : '' // check if the handler exist
const baseUrl = req.baseUrl ? req.baseUrl : '' // adding the base url if the handler is child of other handler
return route ? `${baseUrl === '/' ? '' : baseUrl}${route}` : 'unknown route'
}
const fs = require('fs')
@rewonc
rewonc / app.js
Last active October 26, 2021 00:16
AngularJS/PhoneGap/Ionic: filter to convert links for opening in separate mobile window
//*
//* See the JS Fiddle: http://jsfiddle.net/sxcjmoj5/3/
//*
//*
// make sure ngSanitize module is installed:
// https://docs.angularjs.org/api/ngSanitize
//
// To convert links from plaintext, you must use the linky filter which is included with ngSanitize
// https://docs.angularjs.org/api/ngSanitize/filter/linky
//
@mircobabini
mircobabini / Angular.Ionic.HardwareBackButtonManager.js
Last active November 8, 2018 08:44
HardwareBackButtonManager Service for Ionic (Angular.js) provides an interface to easily enable or disable the hardware back button on Android
.service( 'HardwareBackButtonManager', function($ionicPlatform){
this.deregister = undefined;
this.disable = function(){
this.deregister = $ionicPlatform.registerBackButtonAction(function(e){
e.preventDefault();
return false;
}, 101);
}
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@deemstone
deemstone / line-by-line.js
Last active January 20, 2020 05:40
By Nodejs , read large file line by line. mainly created for logfile processing.
/*
* 逐行读取文件
* 分段读取文件
*/
var fs = require('fs');
//每段读取的长度
//@param inputFile{filepath}
//@param onEnd{func} 所有内容读完了
module.exports = function(inputFile, onEnd){
var sLength = 1024;