Skip to content

Instantly share code, notes, and snippets.

Avatar
🛠️
*react->redux

Sean Zhang sean7218

🛠️
*react->redux
View GitHub Profile
@sean7218
sean7218 / .gitlab-ci.yml
Created Oct 30, 2019 — forked from Mazuh/.gitlab-ci.yml
Example of gitlab CI/CD for a create-react-app application on Amazon S3 Bucket.
View .gitlab-ci.yml
image: nikolaik/python-nodejs:latest
stages:
- install
- test
- deploy
prodInstall:
stage: install
script:
View UIFont_Family.swift
for family in UIFont.familyNames.sorted() {
let name = UIFont.fontNames(forFamilyName: family)
print("Family \(family) and Name: \(name)")
}
/*
Family Academy Engraved LET and Name: ["AcademyEngravedLetPlain"]
Family Al Nile and Name: ["AlNile", "AlNile-Bold"]
Family American Typewriter and Name: ["AmericanTypewriter-CondensedBold", "AmericanTypewriter-Condensed", "AmericanTypewriter-CondensedLight", "AmericanTypewriter", "AmericanTypewriter-Bold", "AmericanTypewriter-Semibold", "AmericanTypewriter-Light"]
View SnappingCollectionViewLayout.swift
class SnappingCollectionViewLayout: UICollectionViewFlowLayout {
override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint, withScrollingVelocity velocity: CGPoint) -> CGPoint {
guard let collectionView = collectionView else { return super.targetContentOffset(forProposedContentOffset: proposedContentOffset, withScrollingVelocity: velocity) }
var offsetAdjustment = CGFloat.greatestFiniteMagnitude
let horizontalOffset = proposedContentOffset.x + collectionView.contentInset.left
let targetRect = CGRect(x: proposedContentOffset.x, y: 0, width: collectionView.bounds.size.width, height: collectionView.bounds.size.height)
@sean7218
sean7218 / UIImageView.swift
Created Aug 13, 2018
load the image from url
View UIImageView.swift
extension UIImageView {
func load(url: URL) {
DispatchQueue.global().async { [weak self] in
if let data = try? Data(contentsOf: url) {
if let image = UIImage(data: data) {
DispatchQueue.main.async {
self?.image = image
}
}
}
View checkbox.mm
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
if ([selectedRowsArray containsObject:[contentArray objectAtIndex:indexPath.row]]) {
View midterm.c
#include <stdio.h>
int main(){
printf("HELLO WORLD\n");
return 0;
}
View draft.py
class StackView(View):
def get(request):
return render(request, 'stacker/stack.html', context)