Skip to content

Instantly share code, notes, and snippets.

View manjufy's full-sized avatar
💭
Building Stuff

Manjunath Reddy manjufy

💭
Building Stuff
View GitHub Profile
@manjufy
manjufy / sql-tips.sql
Created July 31, 2018 00:13
SQL Tips
SHOW ENGINE INNODB STATUS; -- InnoDB Monitor output
@manjufy
manjufy / engineering-quotes.md
Last active June 14, 2018 14:03
Engineering Quotes

Quotes

My take is that code is not magic. Developers should always seek deeper understanding of the platforms 
and languages they use. By doing so; programmers gain valuable confidence and knowledge which in turn 
positively impacts code quality, system architecture and productivity.
@manjufy
manjufy / glossary.md
Created June 14, 2018 05:44
Computer Glossary

Computer Glossary

ECMA - European Computer Manufacturers Association, or ECMA

@manjufy
manjufy / javascript.md
Last active June 14, 2018 03:24
Javascript tips

Tips

In JavaScript, any function can return a new object. When it’s not a constructor function or class, it’s called a factory function.

class Foo {}
console.log(typeof Foo); // function, ES6 desugared class

References

@manjufy
manjufy / js-axios-mock.js
Created June 14, 2018 02:46
Mocking axios
let axios = { // mocks
get: function(x) {
return new Promise(resolve => {
setTimeout(() => {
resolve({data: x})
}, 2000)
})
}}
let query = 'mangos'
async function fetchData(query) {
@manjufy
manjufy / mac-commands.sh
Created June 6, 2018 03:14
Mac Commands
-- See the size of the directory
du -sh /directory/path
-- How to tell what my timezone offset of the database is
select @@global.time_zone, @@session.time_zone;
select timediff( now(), utc_timestamp());
@manjufy
manjufy / brunch-config.js
Created April 3, 2018 09:34
Phoenix Brunch Config With NPM
exports.config = {
// See http://brunch.io/#documentation for docs.
files: {
javascripts: {
joinTo: "js/app.js"
// To use a separate vendor.js bundle, specify two files path
// http://brunch.io/docs/config#-files-
// joinTo: {
// "js/app.js": /^js/,
@manjufy
manjufy / javascript-prevent-form-submit.js
Created March 24, 2018 15:30
Prevent form submission on enter
$('body').keypress(function (e) {
if(e.which === 13) {
e.preventDefault();
}
})
@manjufy
manjufy / csv-string-to-json.js
Created February 6, 2018 05:14
JavaScript/NodeJs CSV String to JSON
//var csv is the CSV file with headers
function csvJSON(csv){
var lines=csv.split("\n");
var result = [];
var headers=lines[0].split(",");
for(var i=1;i<lines.length;i++){