Skip to content

Instantly share code, notes, and snippets.

View aminsol's full-sized avatar
🐦
Learning More

Amin Soltani aminsol

🐦
Learning More
View GitHub Profile
@aminsol
aminsol / insertIntoObjectByPath.js
Created January 18, 2021 08:29
Inserting a value into an object with a path string and the second file is about finding a value in an object with a path
function createObjectFromPath (root, path, value) {
const segments = path.split('.')
let cursor = root
let segment
for (let i = 0; i < segments.length; i++) {
segment = segments[i]
if (segment === '[]') {
continue
}
let newObj = cursor[segment] || {}
@aminsol
aminsol / Netsuite Country List PHP Array
Created May 11, 2015 05:52
Netsuite Country List PHP Array
$countries = array(
"_afghanistan" => "AF",
"_alandIslands" => "AX",
"_albania" => "AL",
"_algeria" => "DZ",
"_americanSamoa" => "AS",
"_andorra" => "AD",
"_angola" => "AO",
"_anguilla" => "AI",
"_antarctica" => "AQ",
@aminsol
aminsol / Netsuite Country List PHP Array
Created April 29, 2015 04:47
Netsuite Country List PHP Array
$countries = array(
"AF" => "_afghanistan",
"AX" => "_alandIslands",
"AL" => "_albania",
"DZ" => "_algeria",
"AS" => "_americanSamoa",
"AD" => "_andorra",
"AO" => "_angola",
"AI" => "_anguilla",
"AQ" => "_antarctica",