Skip to content

Instantly share code, notes, and snippets.

View DigitalZebra's full-sized avatar
🦓

Drew DigitalZebra

🦓
View GitHub Profile
@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 = [];
@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
import React, {useState, useEffect} from 'react';
import {
SafeAreaView,
Text,
View,
TextInput,
StatusBar,
ActivityIndicator,
} from 'react-native';
import Svg, {Circle} from 'react-native-svg';
@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)
import React from 'react';
import {View, SafeAreaView, StyleSheet, ScrollView} from 'react-native';
import Svg, {Defs, LinearGradient, Stop, Rect} from 'react-native-svg';
import {MotiView} from 'moti';
const Gradient = () => (
<Svg viewBox="0 0 100 100">
<Defs>
<LinearGradient id={'gradient'} x1={'0%'} y1={'0%'} x2={'100%'} y2={'0%'}>
<Stop stopOpacity={0} stopColor={'rgb(225, 225, 225)'} offset={'0%'} />
@KrisRJack
KrisRJack / Array+Extension.swift
Last active July 24, 2022 20:13
Helpful Swift Extensions
import UIKit
extension Array where Element == NSLayoutConstraint {
/// Activates each constraint in an array of `NSLayoutConstraint`.
///
/// Example usage: `[view.heightAnchor.constraint(equalToConstant: 30), view.widthAnchor.constraint(equalToConstant: 30)].activate()`
func activate() {
NSLayoutConstraint.activate(self)
}
@ehxxn
ehxxn / ReactNativeResponsiveUtilities.ts
Last active September 1, 2022 11:36
React Native Responsive Utility Functions
import { Dimensions } from 'react-native';
const { height: screenHeight, width: screenWidth } = Dimensions.get('window');
const EACH_HEIGHT_UNIT = screenHeight / 100
const EACH_WIDTH_UNIT = screenWidth / 100
/**
* device height percentage
*/
import UIKit
class ViewController: UIViewController {
let textViewWrapper = TextViewWrapper()
override func viewDidLoad() {
super.viewDidLoad()
// The problem view! I want to add this one to my set of Auto Layout constraints,
// even though it's not using Auto Layout internally.
@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
extension Error {
var code: Int { return (self as NSError).code }
var domain: String { return (self as NSError).domain }
var userInfo: [String:Any] { return (self as NSError).userInfo }
func timeAfterWhichToRetry(retryCount: Int) -> TimeInterval? {
// CloudKit suggests us retry too often, so slow us down as we retry a lot, up to 5 minutes
if let suggestedTimeout = suggestedTimeAfterWhichToRetry {
if suggestedTimeAfterWhichToRetry == 0 {
return 0