Skip to content

Instantly share code, notes, and snippets.

View IhwanID's full-sized avatar

Ihwan IhwanID

View GitHub Profile
@cupnoodle
cupnoodle / delayedExpectation.swift
Created June 20, 2018 11:18
Swift unit test with delay to wait the UI to present
let alertExpectation = XCTestExpectation(description: "testAlertShouldAppear")
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0, execute: {
XCTAssertTrue(loginVC.presentedViewController is UIAlertController)
alertExpectation.fulfill()
})
wait(for: [alertExpectation], timeout: 1.5)
@edc0der
edc0der / ActivityIndicatorOverlay.swift
Last active December 17, 2023 13:37
iOS + Swift: Display activity indicator overlay - UIViewController extension
import UIKit
fileprivate let overlayViewTag: Int = 999
fileprivate let activityIndicatorViewTag: Int = 1000
// Public interface
extension UIView {
func displayAnimatedActivityIndicatorView() {
setActivityIndicatorView()
}
@MaskyS
MaskyS / main.dart
Last active November 25, 2022 05:35
An example showing how we can tap on a ListTile to open a PopUpMenuButton in Flutter.
import 'package:flutter/material.dart';
void main() {
runApp(new MaterialApp(
// Title
title: "Example App",
// Home
home: new ListTileWithPopupMenuButton()
));
}
@kcrawford
kcrawford / gist:00994c6246472d73e6a8893cb84d3e9c
Last active April 20, 2024 20:23 — forked from chbeer/gist:3666e4b7b2e71eb47b15eaae63d4192f
Calling AppleScript from Swift App, passing a parameter. Basic
import Carbon
//guard let url = Bundle.main.url(forResource: "SendFinderMessage", withExtension: "scpt") else {
// exit(0)
//}
//guard let script = NSAppleScript(contentsOf: url, error: &errors) else {
// exit(0)
//}
@branflake2267
branflake2267 / main.dart
Created April 16, 2018 01:18
Flutter - Using the Refresh Indicator
import 'dart:async';
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
@yi-jiayu
yi-jiayu / autoreplier.py
Last active March 9, 2025 14:40
Automatic replies for Telegram (Updated for Telethon 1.6.2)
import time
from telethon import TelegramClient, events
# sample API_ID from https://github.com/telegramdesktop/tdesktop/blob/f98fdeab3fb2ba6f55daf8481595f879729d1b84/Telegram/SourceFiles/config.h#L220
# or use your own
api_id = 17349
api_hash = '344583e45741c457fe1862106095a5eb'
# fill in your own details here
@joepie91
joepie91 / wildcard-certificates.md
Last active July 2, 2024 11:59
Why you probably shouldn't use a wildcard certificate

Recently, Let's Encrypt launched free wildcard certificates. While this is good news in and of itself, as it removes one of the last remaining reasons for expensive commercial certificates, I've unfortunately seen a lot of people dangerously misunderstand what wildcard certificates are for.

Therefore, in this brief post I'll explain why you probably shouldn't use a wildcard certificate, as it will put your security at risk.

A brief explainer

It's generally pretty poorly understood (and documented!) how TLS ("SSL") works, so let's go through a brief explanation of the parts that are important here.

The general (simplified) idea behind how real-world TLS deployments work, is that you:

//
// Config.swift
// Analytics
//
public protocol AnalyticsConfig {
static var analyticsKey: String { get }
static var appVersion: String { get }
}
@branflake2267
branflake2267 / main.dart
Created March 3, 2018 21:32
Flutter - Using the future builder with infinite list view.
import 'dart:async';
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
@Krazybug
Krazybug / omercy.py
Last active April 20, 2025 01:11
O'Reilly free ebooks downloader
'''
O'Meirrcy !!!! Download free ebooks from O'Reilly
Usage:
> git clone https://gist.github.com/Krazybug/1ae50814d25b0a1d862dfdf7161ee503
> mv 1ae50814d25b0a1d862dfdf7161ee503 omercy
> cd omercy
> pip install requests
> pip install bs4
> python omercy.py