Skip to content

Instantly share code, notes, and snippets.

View cbess's full-sized avatar
💭
Coding for Jesus' glory. Soli Deo gloria

C. Bess cbess

💭
Coding for Jesus' glory. Soli Deo gloria
View GitHub Profile
@SergLam
SergLam / UITableView+Refresh.swift
Last active August 30, 2023 08:07
UITableView - safe reload + section headers+footers reload without animation
import UIKit
extension UITableView {
func isCellVisible(section: Int, row: Int) -> Bool {
guard let indexes = self.indexPathsForVisibleRows else {
return false
}
return indexes.contains{ $0.section == section && $0.row == row }
}
@steipete
steipete / UIWindow+PSPDFAdditions.h
Last active June 1, 2023 18:24
Mac Catalyst: Get the NSWindow from a UIWindow (Updated for macOS 11 Big Sur, also works with Catalina)
// Don't forget to prefix your category!
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIWindow (PSPDFAdditions)
#if TARGET_OS_UIKITFORMAC
@raprasad
raprasad / change_password.md
Last active March 15, 2024 17:21
django user; change password from shell

update django password

general changes

To use in dev environments

  • after python manage.py shell
from django.contrib.auth.models import User
@adv0r
adv0r / S3Client.js
Created July 27, 2017 17:02
AWS s3 : Generate a pre-signed URL - step-by-step. {Node.js}
//A quick way to generate valid URL to GET files hosted on private AWS S3 bucket
//I didn't want to use an SKD so I followed the documentation to make my own and learn
//The code is dirty, but since I couln't find anything online,
//I figured this could be handy to someone
//Requirements : Node and Crypto-js (install with npm install crypto-js)
//Remote settings-----------------------------------------------------------
@sirodoht
sirodoht / migrate-django.md
Last active April 20, 2024 09:52
How to migrate Django from SQLite to PostgreSQL

How to migrate Django from SQLite to PostgreSQL

Dump existing data:

python3 manage.py dumpdata > datadump.json

Change settings.py to Postgres backend.

Make sure you can connect on PostgreSQL. Then:

@futurist
futurist / bongo.sh
Last active February 11, 2018 14:56 — forked from nhoening/bongo.sh
Allowing to pass a query for exporting specific data. Added a LIMIT option to limit the number of returned results. Added a debug switch to see errors.
#!/bin/bash
LOADING=false
DEBUG=/dev/null
usage()
{
cat << EOF
usage: $0 [options] <DBNAME>
@webserveis
webserveis / material text sizes.md
Last active September 20, 2023 10:10 — forked from passsy/material text sizes.md
Material font sizes

Material text sizes XML for Android

Simple helper file for standard text sizes in material design. The sizes are provided by the material design documentation https://www.google.com/design/spec/style/typography.html#typography-roboto

material typography

Standard Styles

Too many type sizes and styles at once can wreck any layout. A typographic scale is a limited set of type sizes that work well together, along with the layout grid. The basic set of styles are based on a typographic scale of 12, 14, 16, 20, and 34.

@nrollr
nrollr / MySQL_macOS_Sierra.md
Last active January 31, 2024 14:45
Install MySQL on Sierra using Homebrew

Install MySQL on macOS Sierra

This procedure explains how to install MySQL using Homebrew on macOS Sierra 10.12

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.

Install MySQL

At this time of writing, Homebrew has MySQL version 5.7.15 as default formulae in its main repository :

public class PrimaryKeyFactory {
/**
* primary key field name
*/
public static final String PRIMARY_KEY_FIELD = "id";
/**
* Singleton instance.