Skip to content

Instantly share code, notes, and snippets.

View superKalo's full-sized avatar

Kaloyan Kosev superKalo

View GitHub Profile
@viclafouch
viclafouch / abort-requests-in-react.js
Last active January 20, 2025 19:32
A React component that fetching data on mount and avoiding memory leaks on unmount with AbortController
import React, { useState, useEffect, useCallback } from 'react'
function Posts() {
const [isLoading, setIsLoading] = useState(true)
const [posts, setPosts] = useState([])
const fetchPosts = useCallback(async controller => {
try {
// Imagine that the fetch is going to take 3 seconds to finish
await new Promise(resolve => setTimeout(resolve, 3000))
const styleObject = StyleSheet.create({
merged: {
color: 'black',
fontSize: 11,
},
black: {
color: 'black',
},
smallFont: {
@gricard
gricard / webpack4upgrade.md
Last active February 29, 2024 20:23
Just some notes about my attempt to upgrade to webpack 4

If you enjoyed reading this, I'm intending to do more blogging like this over here: https://cdgd.tech

This is not a complaint about Webpack or v4 in any way. This is just a record of my process trying it out so I could provide feedback to the webpack team

Hmm... I don't see any docs for 4.0 on https://webpack.js.org. I guess I'll just wing it. All I need to do is npm i -D webpack@next, right?

+ [email protected]
import UIKit
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet weak var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
NSLayoutConstraint.activate([
tableView.topAnchor.constraint(equalTo: view.topAnchor),
@HristoEftimov
HristoEftimov / NativeScript_Bottom_Nav_templ.jsx
Last active May 19, 2017 07:20
NativeScript: scrollable application with a fixed bottom navigation with nice icon buttons
<ActionBar title="All cocktails"></ActionBar>
<GridLayout rows="*,60">
<ScrollView row="0">
<WrapLayout orientation="horizontal">
<GridLayout *ngFor="let item of data" width="50%" height="150">
<Image
src="~/images/{{ item.imageURL }}"
stretch="aspectFill"
row="1"
></Image>
@parshap
parshap / node-modules-in-react-native.md
Last active January 26, 2025 06:24
Running Node Modules in React Native

Running Node Modules in React Native

How to use packages that depend on Node.js core modules in React Native.

See the [node-libs-react-native][node-libs-react-native] library as a convenience for implementing this method.

Node.js Core Modules

@chris-jamieson
chris-jamieson / functional-spec.md
Created March 9, 2017 16:06
Writing functional specification guidelines

Once you are ready to hire a developer, what should you do to mitigate execution / build risk?

  1. Writing a good functional specification is key to getting the build phase of this project right. It's not easy to do but it's mostly just about thinking hard and writing out all the boring details of your desired outcome. The best guide for this is Joel Spolsky (recently sold Trello for $425M). He wrote a 4 part series on this, starting here, and also has an example (real) spec on his website here (the PDF link is broken, this is the real one)

  2. Before you start on a spec, trim down your functionality to the absolute bare minimum - and be brutal with it! Imagine you had to complete it in one day, or imagine it was only a single feature... take away everything that isn't fundamental

@IvayloAtanasov
IvayloAtanasov / Laravel-Angular-Setup.md
Last active March 12, 2019 15:42
Laravel 5.2 + Angular 2.0 setup guide

#This guide will walk you through the steps needed to setup an empty project using the 2 frameworks into a single repository.

##You will need to have installed:

apache: >= 2.4.9
php: >= 5.5.12
composer: >= 1.2.1
node: >= 4.1.0
npm: >= 3.0.0
git: >= 1.9.5
1. Highlight a recommended option,

2. Allow users to switch currency (€/$/£)

3. Allow users to switch pricing monthly/yearly

4. Keep the entire pricing plan area clickable

5. Use slider to calculate how much a user would save

6. Provide free first month for good engagement

7. Prominently highlight testimonials prominently

8. Repeating call to action on top and bottom

9. Sell benefits instead of features

10. Indicate that users can cancel any time

@boydc7
boydc7 / gitdefaults.txt
Last active November 2, 2023 17:47
Reasonable git defaults
# push relevant tags when pushing branches
git config --global push.followTags true
# Make git pull do a --recurse-submodules flag on each pull
git config --global submodule.recurse true
# Make git push do an on-demand try of pushing sub-modules before pushing main repos
git config --global push.recurseSubmodules on-demand
# push only current branch on a push