Skip to content

Instantly share code, notes, and snippets.

@ethanhuang13
ethanhuang13 / FacebookAuth.swift
Last active March 28, 2024 08:24
FacebookAuth is for iOS app developers who need to support Facebook login but don't want to use the official SDK
//
// FacebookAuth.swift
// GitHub: ethanhuang13
// Twitter: @ethanhuang13
import AuthenticationServices
import SafariServices
/*
Updated:
CREATE EXTENSION pgcrypto;
CREATE OR REPLACE FUNCTION totp(key BYTEA, clock_offset INT DEFAULT 0) RETURNS INT AS $$
DECLARE
c BYTEA := '\x000000000' || TO_HEX(FLOOR(EXTRACT(EPOCH FROM NOW()) / 30)::INT + clock_offset);
mac BYTEA := HMAC(c, key, 'sha1');
trunc_offset INT := GET_BYTE(mac, 19) % 16;
result INT := SUBSTRING(SET_BIT(SUBSTRING(mac FROM 1 + trunc_offset FOR 4), 7, 0)::TEXT, 2)::BIT(32)::INT % 1000000;
BEGIN
RETURN result;
END;
@AveYo
AveYo / .. MediaCreationTool.bat ..md
Last active June 29, 2024 01:12
Universal MediaCreationTool wrapper for all MCT Windows 10 versions - MOVED TO github.com/AveYo/MediaCreationTool.bat
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active July 7, 2024 05:12 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy
@chockenberry
chockenberry / finder_icons.sh
Last active February 10, 2024 19:05
A simple shell script to turn the Finders desktop icons on and off
#!/bin/sh
defaults read com.apple.finder CreateDesktop > /dev/null 2>&1
enabled=$?
if [ "$1" = "off" ]; then
if [ $enabled -eq 1 ]; then
defaults write com.apple.finder CreateDesktop false
osascript -e 'tell application "Finder" to quit'
open -a Finder
@rupey
rupey / FeedbackViewController.m
Last active January 7, 2016 02:14
Capturing customer feedback with a device log on iOS
#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>
#include <asl.h>
@interface FeedbackViewController : UIViewController <MFMailComposeViewControllerDelegate>
@property (nonatomic, strong) IBOutlet UITextView *textView;
@property (nonatomic, strong) NSString *feedbackType;
@end
@boboldehampsink
boboldehampsink / ios_disable_push_notifications.js
Created March 17, 2015 15:11
Cordova - after_platform_add hook to disable push notifications code
#!/usr/bin/env node
var GCC_PREPROCESSOR_DEFINITIONS = '"$(inherited) DISABLE_PUSH_NOTIFICATIONS=1"';
var fs = require("fs");
var path = require("path");
var xcode = require('xcode');
var projectRoot = process.argv[2];
function getProjectName(protoPath) {
@mikeabdullah
mikeabdullah / gist:0bfa45534dc0b75e32a8
Last active August 29, 2015 14:13
Date parsing with NSDataDetector
NSDataDetector *detector = [NSDataDetector
dataDetectorWithTypes:NSTextCheckingTypeDate
error:NULL];
NSTextCheckingResult *result = [detector
firstMatchInString:string
options:0
range:NSMakeRange(0, string.length)];
return result.date;
@stefanocrosta
stefanocrosta / wrsynch.sh
Last active July 18, 2018 01:05
continuously rsync on file modification with fswatch (wrsync: watch & rsync) [or: an fswatch wrapper]
#!/bin/bash
# an rsync script that will synchronize files every time there's a modification
# in a WATCHed location, detected through fswatch
# https://github.com/emcrisostomo/fswatch
# (install fswatch through brew)
#
# this script could even be more general and allow executing anything,
# not just rsync; it's actually even overkill for the way it's used, since
# rsync is simple re-launched entirely and not just for the modified file!
@alexeckermann
alexeckermann / iphone6.rb
Created October 3, 2014 01:11
iPhone 6 Reservation Availability in Australia
# iPhone 6 Reservation Availability in Australia
# !! Please use responsibly. Personal use only !!
# `ruby iphone6.rb` - list all available models in all stores
# `ruby iphone6.rb R405` - list available models for a specific store, Rundle Place in this example.
require 'open-uri'
require 'json'
MODEL_NAMES = {
"MG4A2X/A" => "iPhone 6 Space Grey 128GB",