Skip to content

Instantly share code, notes, and snippets.

View DaniAkash's full-sized avatar
👨‍🏭

Dani Akash DaniAkash

👨‍🏭
View GitHub Profile
@DaniAkash
DaniAkash / Gatsby React Native Link component.tsx
Last active June 19, 2020 06:43
A gatsby link component using @expo/html-elements for react native web
@DaniAkash
DaniAkash / machine.js
Created April 2, 2020 09:41
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@DaniAkash
DaniAkash / PostgreSQL Queries.md
Last active February 29, 2020 05:48
Common PostgreSQL Commands

create table Users( create_date date, user_handle uuid, last_name text, first_name text);

insert into Users (create_date, user_handle, last_name, first_name) values ('2018-06-06', '029f7457-cd7b-4c43-a122-1c44956e906d', 'akash', 'dani');

insert into Users (create_date) values (now());

@DaniAkash
DaniAkash / MongoDB Queries.md
Last active March 21, 2020 05:17
Common MongoDB Operations

Basic database operations

db

use db-name

show dbs

show collections

@DaniAkash
DaniAkash / CHANGELOG.md
Created November 28, 2019 05:27
Quick Changelog snippet

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[Unreleased]

[major.minor.patch] - YYYY-MM-DD

@DaniAkash
DaniAkash / unsafe-pathassignment.js
Created May 10, 2019 12:58
a javascript object path-value assignment operation that is vulnerable to prototype pollution
var pathAssignment = (obj, path, value) => {
var segments = path.split(".");
var key = segments.splice(0,1)[0];
if(segments.length) {
if(obj[key]) {
obj[key] = pathAssignment(obj[key], segments.join('.'), value);
} else {
obj[key] = pathAssignment({}, segments.join('.'), value);
}
} else {
@DaniAkash
DaniAkash / safe-merge.js
Created May 10, 2019 12:04
A javascript object merge operation that will not allow prototype pollution to happen
var merge = function(target, source) {
for(var attr in source) {
if(attr === "__proto__") continue; // Do not merge the property if it's name is __proto__
if(typeof(target[attr]) === "object" && typeof(source[attr]) === "object") {
merge(target[attr], source[attr]);
} else {
target[attr] = source[attr];
}
}
return target;
@DaniAkash
DaniAkash / unsafe-merge.js
Created May 10, 2019 03:18
a javascript object merge operation vulnerable to prototype pollution
var merge = function(target, source) {
for(var attr in source) {
if(typeof(target[attr]) === "object" && typeof(source[attr]) === "object") {
merge(target[attr], source[attr]);
} else {
target[attr] = source[attr];
}
}
return target;
};
@DaniAkash
DaniAkash / React-Native-Native-Libraries.text
Last active October 18, 2020 20:05
React Native common native libraries
File System:
https://github.com/itinance/react-native-fs
https://github.com/joltup/rn-fetch-blob
Image Picker:
https://github.com/ivpusic/react-native-image-crop-picker
https://github.com/react-native-community/react-native-image-picker
Share:
https://facebook.github.io/react-native/docs/share
@DaniAkash
DaniAkash / package.json
Created May 15, 2017 17:12
Dependencies for using webpack with configuration as in - https://gist.github.com/DaniAkash/ec2a301c655d1a5970195887e0bc1f3e
{
"name": "meme-creator",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"webpack": "webpack",
"watch": "webpack-dev-server"
},