Skip to content

Instantly share code, notes, and snippets.

View mingsai's full-sized avatar
🎯
Focusing

Tommie N. Carter, Jr. mingsai

🎯
Focusing
View GitHub Profile
@sekati
sekati / xcode-build-bump.sh
Created July 24, 2012 20:44
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@anantn
anantn / firebase_detect_data.js
Created December 18, 2012 00:54
Firebase: Detecting if data exists. This snippet detects if a user ID is already taken
function go() {
var userId = prompt('Username?', 'Guest');
checkIfUserExists(userId);
}
var USERS_LOCATION = 'https://SampleChat.firebaseIO-demo.com/users';
function userExistsCallback(userId, exists) {
if (exists) {
alert('user ' + userId + ' exists!');
@kch
kch / ftff-events.rb
Created August 3, 2010 13:34
mac: watch home dir via fsevents and set encoding attr and reveal extension for txt and rb files
#!/usr/bin/ruby
# encoding: UTF-8
require 'rubygems'
require 'fsevent'
require 'shellwords'
class Time
def age_in_seconds(now = Time.now)
now - self
@esimonetti
esimonetti / repair.php
Last active November 20, 2023 13:17
Sugar CLI Repair - Instance as script argument - USE TOOTHPASTE INSTEAD! https://github.com/esimonetti/toothpaste
<?php
// Enrico Simonetti
// enricosimonetti.com
//
// 2017-11-01 on Sugar 7.9.2.0
function usage($error = '') {
if (!empty($error)) print(PHP_EOL . 'Error: ' . $error . PHP_EOL);
print(' php ' . __FILE__ . ' --instance /full/path' . PHP_EOL);
@soffes
soffes / CLLocationCoordinate2D+Equatable.swift
Last active October 4, 2023 18:50
Add Equatable to CLLocationCoordinate2D
import CoreLocation
extension CLLocationCoordinate2D: Equatable {}
public func ==(lhs: CLLocationCoordinate2D, rhs: CLLocationCoordinate2D) -> Bool {
return lhs.latitude == rhs.latitude && lhs.longitude == rhs.longitude
}
@NSURLSession0
NSURLSession0 / cloudkit-server.php
Created February 7, 2016 21:36
CloudKit server-to-server in PHP
<?php
// Constants
$KEY_ID = 'YOUR_KEY_ID';
$CONTAINER = 'YOUR_CONTAINER';
$PRIVATE_PEM_LOCATION = 'eckey.pem'; // Store this file outside the public folder!
// Config
$url = 'https://api.apple-cloudkit.com/database/1/' . $CONTAINER . '/development/public/records/query';
$body = '{"query":{"recordType":"Articles"}}';
@spllr
spllr / cloudkit-request.js
Last active August 28, 2023 12:04
Setting up an authenticated CloudKit server-to-server request
/**
* Demonstrates how to use Apple's CloudKit server-to-server authentication
*
* Create private key with: `openssl ecparam -name prime256v1 -genkey -noout -out eckey.pem`
* Generate the public key to register at the CloudKit dashboard: `openssl ec -in eckey.pem -pubout`
*
* @see https://developer.apple.com/library/prerelease/ios/documentation/DataManagement/Conceptual/CloutKitWebServicesReference/SettingUpWebServices/SettingUpWebServices.html#//apple_ref/doc/uid/TP40015240-CH24-SW6
*
* @author @spllr
*/
@mayoff
mayoff / UIBezierPath+forEachElement.h
Created December 2, 2012 06:51
dragging an object along a CGPath on iOS demo
#import <UIKit/UIKit.h>
@interface UIBezierPath (forEachElement)
- (void)forEachElement:(void (^)(CGPathElement const *element))block;
@end
@ponnamkarthik
ponnamkarthik / auto_resize_webview.dart
Created June 5, 2019 04:07
Flutter auto resize webview based on its content
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
@xjones
xjones / TransitionController.h
Created November 26, 2011 03:48
TransitionController for animating iOS view controller transitions w/o a controller stack
//
// TransitionController.h
//
// Created by XJones on 11/25/11.
//
#import <UIKit/UIKit.h>
@interface TransitionController : UIViewController