Skip to content

Instantly share code, notes, and snippets.

View DigitalZebra's full-sized avatar
🦓

Drew DigitalZebra

🦓
View GitHub Profile
@chrisjacob
chrisjacob / README.md
Created February 14, 2011 14:31
Setup GitHub Pages "gh-pages" branch as a subfolder within the "master" project on your local checkout - a step-by-step guide.

Intro

Setup GitHub Pages "gh-pages" branch as a subfolder within the "master" project on your local checkout.

IMPORTANT

If you plan on switching between different branches (e.g. git checkout master-experiment then revert back with git checkout master) you will loose your child folder from this tutorial (because it's in your .gitignore and is not part of your master branch).

@mrprompt
mrprompt / ExportSQLite.grt.lua
Created October 31, 2013 15:49
MySQL WorkBench Plugin to export database to SQLite
-- ExportSQLite: SQLite export plugin for MySQL Workbench
-- Copyright (C) 2009 Thomas Henlich
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
@DTFagus
DTFagus / analyse_watchers.js
Created August 12, 2014 14:22
Bookmarklet to analyse angular watchers
javascript: (function() {
var root = $(document.getElementsByTagName('html'));
var watchers = [];
var attributes = [];
var attributes_with_values = [];
var elements = [];
var elements_per_attr = [];
var scopes = [];
@JeOam
JeOam / Animation.md
Last active February 18, 2024 21:18
iOS Core Animation: Advanced Techniques, Part 1: The Layer Beneath

Author: https://www.cyanhall.com/

1. The Layer Tree

Core Animation's original name is Layer Kit

Core Animation is a compositing engine; its job is to compose different pieces of visual content on the screen, and to do so as fast as possible. The content in question is divided into individual layers stored in a hierarchy known as the layer tree. This tree forms the underpinning for all of UIKit, and for everything that you see on the screen in an iOS application.

In UIView, tasks such as rendering, layout and animation are all managed by a Core Animation class called CALayer. The only major feature of UIView that isn’t handled by CALayer is user interaction.

There are four hierarchies, each performing a different role:

@VictorTaelin
VictorTaelin / promise_monad.md
Last active March 23, 2024 17:49
async/await is just the do-notation of the Promise monad

async/await is just the do-notation of the Promise monad

CertSimple just wrote a blog post arguing ES2017's async/await was the best thing to happen with JavaScript. I wholeheartedly agree.

In short, one of the (few?) good things about JavaScript used to be how well it handled asynchronous requests. This was mostly thanks to its Scheme-inherited implementation of functions and closures. That, though, was also one of its worst faults, because it led to the "callback hell", an seemingly unavoidable pattern that made highly asynchronous JS code almost unreadable. Many solutions attempted to solve that, but most failed. Promises almost did it, but failed too. Finally, async/await is here and, combined with Promises, it solves the problem for good. On this post, I'll explain why that is the case and trace a link between promises, async/await, the do-notation and monads.

First, let's illustrate the 3 styles by implementing

@victorchee
victorchee / Fireworks.swift
Created December 29, 2018 06:11
Fireworks effect by emitter.
let emitterLayer = CAEmitterLayer()
emitterLayer.frame = navigationView.bounds
emitterLayer.renderMode = .additive
emitterLayer.emitterMode = .outline
emitterLayer.emitterShape = .line
emitterLayer.emitterSize = CGSize(width: 50, height: 0)
emitterLayer.emitterPosition = CGPoint(x: navigationView.bounds.width / 2, y: navigationView.bounds.height)
emitterLayer.velocity = 1
emitterLayer.seed = (arc4random() % 100) + 1
navigationView.layer.insertSublayer(emitterLayer, at: 0)
@josephlord
josephlord / FetchedResultsControllerPublisher.swift
Created June 10, 2019 23:08
Making a Combine publisher from a FetchedResultsController
//
// FetchedResultsControllerPublisher.swift
// ListsModel
//
// Created by Joseph Lord on 09/06/2019.
// Copyright © 2019 Joseph Lord. All rights reserved.
//
import Foundation
import Combine
@grrrlikestaquitos
grrrlikestaquitos / swiftui-higher-order-component.swift
Last active September 24, 2022 17:09
SwiftUI: Higher Order Component Syntax
// Declaring ContainerView as a HOC
struct ContainerView<C: View> : View {
let childView: C
init(_ childView: () -> (C)) {
self.childView = childView()
}
var body: some View {
childView
@louy
louy / AccessibilityWrapper.tsx
Last active November 30, 2023 10:23
RN Accessibility Wrapper, a custom view that allows you to control the accessibility behaviour of a React Native component tree
/**
* @author Louay Alakkad (github.com/louy)
* @license MIT https://opensource.org/licenses/MIT
*/
import React from 'react'
import PropTypes from 'prop-types'
import {
NativeModules,
ViewProps,
ViewPropTypes,
//
// YeetJSIUTils.h
// yeet
//
// Created by Jarred WSumner on 1/30/20.
// Copyright © 2020 Facebook. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <jsi/jsi.h>