Skip to content

Instantly share code, notes, and snippets.

View ratiw's full-sized avatar

Rati Wannapanop ratiw

  • Nonthaburi, Thailand
View GitHub Profile
@ratiw
ratiw / object_get.js
Last active May 15, 2019 22:14
Retrieve object property using dot notation. Equivalent to Laravel's object_get()
function object_get(obj, key) {
if (!key || $.trim(key) == '') return obj;
$.each(key.split('.'), function(idx, seg) {
if (typeof obj !== 'object' || obj[seg] === undefined) {
obj = undefined;
return obj;
}
obj = obj[seg];
});
return obj;
@ratiw
ratiw / makeAttributes.js
Last active August 29, 2015 14:05
Combine associative array into html attributes or query string
function makeAttributes(arr, connector, separator) {
var out = '';
if (!connector) connector = '=';
if (!separator) separator = ' ';
for (var k in arr) {
out += (out === '') ? '' : separator;
out += k + connector + arr[k];
}
@ratiw
ratiw / Laravel Homestead on Windows.md
Last active February 13, 2020 11:18
#Laravel #Homestead on #Windows

Problem with VirtualBox 4.3.12

It seems there is some problems between Vagrant 1.6.2 and VirtualBox 4.3.12 (the latest at the time or writing this), switching back to VirutalBox 4.3.6 or VirtualBox 4.3.8 seems to eliminate the problem.

update 1: Try both Vagrant 1.6.2 and VirtualBox 4.3.12 on Mac and they seem to work fine!

update 2: You need to enable Virtual Machine option in your BIOS to make VirtualBox work as expected. Saw someone mention about this in Laravel forum about this and it is true.

Also, Vagrant version should be 1.6.2.