Skip to content

Instantly share code, notes, and snippets.

View mubaidr's full-sized avatar
🎯
Adding bugs to web applications!

Muhammad Ubaid Raza mubaidr

🎯
Adding bugs to web applications!
View GitHub Profile
@mubaidr
mubaidr / sequelize-schema-file-generator.js
Last active December 27, 2018 04:46 — forked from manuelbieh/sequelize-schema-file-generator.js
Automatically generates migration files from your sequelize models
const fs = require('fs')
const { sequelize } = require('./api/db/models')
const { models } = sequelize
function toSnakeCase(str, upper) {
if (str.split().every(s => s.toLowerCase() === s)) return str
const snake = str.replace(/([A-Z])/g, $1 => `_${$1.toLowerCase()}`)
@mubaidr
mubaidr / index.html
Created July 25, 2018 16:50 — forked from mac2000/index.html
brain.js demo
<!DOCTYPE html>
<html>
<head>
<title>brain.js</title>
<script src="https://cdn.rawgit.com/BrainJS/brain.js/develop/browser.js"></script>
<script>
function DrawableCanvas(el) {
const px = 10
const ctx = el.getContext('2d')
let x = []
@mubaidr
mubaidr / get_barcode_from_image.js
Created May 6, 2018 16:57 — forked from tbtlr/get_barcode_from_image.js
Barcode recognition with JavaScript - Demo: http://bit.ly/djvUoy
/*
* Copyright (c) 2010 Tobias Schneider
* This script is freely distributable under the terms of the MIT license.
*/
(function(){
var UPC_SET = {
"3211": '0',
"2221": '1',
"2122": '2',
@mubaidr
mubaidr / Startup.cs
Created December 26, 2016 15:09 — forked from tanveery/Startup.cs
LinkedIn APIs for .NET
public void ConfigureAuth(IAppBuilder app)
{
// ...
var linkedInOptions = new LinkedInAuthenticationOptions();
linkedInOptions.ClientId = "Your LinkedIn API Key";
linkedInOptions.ClientSecret = "Your LinkedIn Secret Key";
linkedInOptions.Scope.Add("r_fullprofile");
@mubaidr
mubaidr / memorySizeOfObject.js
Created April 4, 2016 10:52
calculate memory size of javascript object, it is not a accurate value!
function memorySizeOf(obj) {
var bytes = 0;
function sizeOf(obj) {
if(obj !== null && obj !== undefined) {
switch(typeof obj) {
case 'number':
bytes += 8;
break;
case 'string':
@mubaidr
mubaidr / README.md
Last active August 29, 2015 14:07 — forked from addyosmani/README.md

CSS Layout Debugger

A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.

One-line version to paste in your DevTools

Use $$ if your browser aliases it:

~ 108 byte version

<div id="consolelog" style="font-family: 'Courier New', Courier, monospace; font-size: 12px; margin: 40px 30px 0px; background-color: white; border: 2px solid black; padding: 10px;"></div>
<input type="text" id="consoleinput" style="margin: 0px 30px; width: 400px;" onkeypress="return evalConsoleInput(event, this.value);" />
<script type="text/javascript">
var appendConsole = function(message, type) {
var color = "black";
if (type === "error") {
color = "red";
} else if (type === "debug") {