Skip to content

Instantly share code, notes, and snippets.

View hamidhadi's full-sized avatar
🎺

Hamid hamidhadi

🎺
View GitHub Profile
@boazFrenkel
boazFrenkel / UICollectionView in a UITableViewCell both with dynamic heights
Created July 11, 2018 12:42
example UICollectionView with dynamic height inside a UITableViewCell
/**************
My cell has a label and under it a collection view with varying number of buttons in different sizes
So I'm letting Autolayout set the position of things and then taking all heights together for the cell height size
*************/
class ButtonCollectionCell: UITableViewCell {
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var collectionViewDistanceFromCellBottomConstraint: NSLayoutConstraint!
@IBOutlet weak var distanceBetweenCollectionToLabelConstraint: NSLayoutConstraint!
@IBOutlet weak var buttonsCollectionView: UICollectionView!
@ptgamr
ptgamr / react-native-deployments.md
Last active November 20, 2018 21:59
Environment configurations for React Native App

Intro

If you ever need a mobile application, you probably have an API endpoint to talk to. And if you're doing it right, you should have different environment for your API, usually it'll be: dev, staging, production.

The problem: How do we do the testing for our app?

We dont' want to perform test againts the production API. We need a way to teach our app to talk to different API environment. But what is the switch?

The naive way:

@jsdario
jsdario / nuke-deps.sh
Last active December 12, 2023 08:36
Script to clean watchman, remove node_modules, clean cache and restart packager for React Native troubleshooting.
#!/bin/bash
# Stop cached listeners
watchman watch-del-all
# Remove installed modules
rm -rf node_modules
# Remove yarn meta files
rm yarn*
@chourobin
chourobin / 0-bridging-react-native-cheatsheet.md
Last active May 4, 2024 14:06
React Native Bridging Cheatsheet
@mikeash
mikeash / runtime-class.m
Created November 22, 2013 16:46
Creating a usable class purely at runtime using the Objective-C runtime APIs.
// clang -fobjc-arc -framework Foundation runtime-class.m
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
@interface Person : NSObject
- (id)initWithFirstName: (NSString *)firstName lastName: (NSString *)lastName age: (NSUInteger)age;
@mjackson
mjackson / color-conversion-algorithms.js
Last active April 14, 2024 08:46
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation
@garyharan
garyharan / _mixins.scss
Created May 5, 2011 15:46
Useful scss mixins (rounded corners, gradients, text-field, button)
@mixin box-shadow($top, $left, $blur, $color, $inset: false) {
@if $inset {
-webkit-box-shadow:inset $top $left $blur $color;
-moz-box-shadow:inset $top $left $blur $color;
box-shadow:inset $top $left $blur $color;
} @else {
-webkit-box-shadow: $top $left $blur $color;
-moz-box-shadow: $top $left $blur $color;
box-shadow: $top $left $blur $color;
}