Skip to content

Instantly share code, notes, and snippets.

Sam samnajian

Block or report user

Report or block samnajian

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@samnajian
samnajian / flatten_array.js
Last active Jul 18, 2016
Flattern array in JS
View flatten_array.js
function flatten_array( arr ){
/**
* Checks if _arr is an array
* @param Array|Mixed _arr variable to check
* @return Bool whether _arr is an array
*/
const is_array = ( _arr ) => {
return typeof _arr === "object" && typeof _arr.concat === "function";
};
@samnajian
samnajian / change-svg-fill-color.js
Created Sep 27, 2017
Trick to change svg fill color
View change-svg-fill-color.js
document.addEventListener('DOMContentLoaded', function() {
/**
* Refrence to object element that has svg as data attribute
**/
const obj = document.querySelector('object');
const svg = obj.contentDocument.querySelector("svg");
svg.style.fill = "red" // change fill color to red
}, false);
You can’t perform that action at this time.