Skip to content

Instantly share code, notes, and snippets.

@mattjgalloway
mattjgalloway / gist:6279363
Created August 20, 2013 09:36
Check if something responds to a certain selector, searching up until a certain class
#import <UIKit/UIKit.h>
#import <objc/runtime.h>
@interface NSObject (MJGResponds)
+ (BOOL)mjg_hasImplementationForSelector:(SEL)selector searchUntilClass:(Class)cls;
@end
@implementation NSObject (MJGResponds)
+ (BOOL)mjg_hasImplementationForSelector:(SEL)selector searchUntilClass:(Class)cls {
//
// Navigator.swift
// tripani
//
// Created by Jesse Lin on 11/8/17.
// Copyright © 2017 Tripani. All rights reserved.
//
import Foundation
import UIKit
desc "Deploy a new version to the App Store"
lane :release do
# 1.Creating Certificates and Provisioning Profiles
cert
sigh(force: true)
# 2.
#ensure_git_status_clean
# 3.Creating the IPA file
extension Date {
func add(_ component: Calendar.Component, value: Int) -> Date {
return Calendar.current.date(byAdding: component, value: value, to: self)!
}
}
@propertyWrapper
struct BeginEndDate {
@asika32764
asika32764 / mysql-rand-between-two-values.sql
Created August 16, 2014 07:41
Mysql Rand() between 2 values
ROUND((RAND() * (max-min))+min)
#!/usr/bin/env php
<?php
function getContents($params)
{
[$self, $file, $startLine, $startColumn, $endLine, $endColumn] = $params;
--$startLine;
--$startColumn;
--$endLine;
--$endColumn;
@justinbellamy
justinbellamy / cltools.sh
Last active March 6, 2022 03:46 — forked from jellybeansoup/cltools.sh
Install Autoconf and Automake on OS X El Capitan
#!/bin/sh
##
# Install autoconf, automake and libtool smoothly on Mac OS X.
# Newer versions of these libraries are available and may work better on OS X
#
# This script is originally from http://jsdelfino.blogspot.com.au/2012/08/autoconf-and-automake-on-mac-os-x.html
#
export build=~/devtools # or wherever you'd like to build
@kumabook
kumabook / Observable.swift
Last active March 12, 2022 06:47
Observer pattern with swift protocol extension
import Foundation
public protocol Observer: Equatable {
associatedtype EventType
func listen(_ event: EventType)
}
public protocol Observable {
associatedtype ObserverType: Observer
associatedtype EventType
{"version":1,"resource":"file:///Users/huge/Desktop/www/ezbuild.quasar.hardhat.node/express-ts/src/Sdk/NFT.ts","entries":[{"id":"s8uH.ts","timestamp":1651332354243}]}
@gatesakagi
gatesakagi / drinkOrderAPI.gs
Last active November 14, 2022 17:30
Google App Script (讀取QueryString並寫入Sheet)
function doGet(e) {
//JSON.stringify(name)
if(typeof e !== 'undefined') {
var params = e.parameter;
var name = params.name;
var drinkIndex = params.drinkindex;
var drink = params.drink;
var drinkPrice = params.drinkprice;
var sugar = params.sugar;
var ice = params.ice;