tech
tutorial
Modern JavaScript Async Patterns
Exploring the evolution from callbacks to async/await and beyond.
Promise Chains vs Async/Await
// Promise chains
fetchUser(id)
.then(user => fetchPosts(user.id))
.then(posts => renderPosts(posts))
.catch(handleError);
// Async/await
try {
const user = await fetchUser(id);
const posts = await fetchPosts(user.id);
renderPosts(posts);
} catch (error) {
handleError(error);
}
The async/await syntax makes asynchronous code much more readable!
tech
tutorial
Building a Hugo Theme from Scratch
Creating a custom Hugo theme has been an exciting journey! Here’s what I learned while building the nomad-tech theme.
Key Concepts
Hugo’s template lookup order is crucial for theme development:
layouts/
├── _default/
│ ├── baseof.html
│ ├── list.html
│ └── single.html
├── partials/
└── section-name/
└── list.html
Hugo Pipes for Assets
Modern Hugo themes should use Hugo Pipes for asset processing:
{{ $scss := resources.Get "scss/main.scss" }}
{{ $css := $scss | resources.ToCSS | resources.Minify | resources.Fingerprint }}
Multilingual Support
Hugo’s i18n system makes multilingual themes straightforward:
nomad
lifestyle
Digital Nomad Visa Guide 2024
Complete guide to digital nomad visas and remote work permits.
Top Nomad-Friendly Countries
- Portugal: D7 Visa (1-2 years)
- Estonia: Digital Nomad Visa (1 year)
- Barbados: Welcome Stamp (1 year)
- Dubai: Virtual Working Program (1 year)
Application Tips
- Income Requirements: Usually $2000-3500/month
- Health Insurance: Mandatory for most programs
- Processing Time: 2-8 weeks typically
- Remote Work Proof: Employment letter or business registration
Planning ahead is key for a smooth nomad journey!
tech
tutorial
CSS Grid vs Flexbox: When to Use What
Understanding the differences between CSS Grid and Flexbox for modern layouts.
Use Flexbox For:
- One-dimensional layouts (rows OR columns)
- Component-level design
- Centering content
- Navigation bars
Use CSS Grid For:
- Two-dimensional layouts (rows AND columns)
- Page-level design
- Complex layouts
- Card grids
/* Flexbox for navigation */
.nav {
display: flex;
justify-content: space-between;
align-items: center;
}
/* Grid for main layout */
.layout {
display: grid;
grid-template-columns: 1fr 3fr 1fr;
grid-template-rows: auto 1fr auto;
}
Both are powerful tools - use them together!
nomad
lifestyle
Best Coworking Spaces in Thailand
My experience working from Thailand’s top coworking spaces.
Bangkok
- HUBBA-TO: Premium space in Thonglor
- Launchpad: Great community, multiple locations
- The Hive: Professional environment
Chiang Mai
- CAMP: The nomad headquarters
- Punspace: Reliable and affordable
- Maya Lifestyle: Modern facilities
Phuket
- Andaman Coworking: Beach vibes
- Outpost: International community
What to Look For
- Stable internet (50+ Mbps)
- Comfortable seating
- Meeting rooms
- Coffee quality (important!)
- Community events
Thailand’s coworking scene is world-class!
tech
tutorial
React Hooks Complete Guide
Master React Hooks with practical examples and best practices.
Essential Hooks
useState
const [count, setCount] = useState(0);
useEffect
useEffect(() => {
document.title = `Count: ${count}`;
}, [count]);
useContext
const theme = useContext(ThemeContext);
Custom Hooks
function useLocalStorage(key, initialValue) {
const [value, setValue] = useState(() => {
return localStorage.getItem(key) || initialValue;
});
const setStoredValue = (newValue) => {
setValue(newValue);
localStorage.setItem(key, newValue);
};
return [value, setStoredValue];
}