Skip to content

Instantly share code, notes, and snippets.

@chensoren
chensoren / gist:3081968
Created July 10, 2012 08:10
ruby openssl AES encrypt and decrypt
require 'base64'
require 'digest'
require 'openssl'
module AESCrypt
def AESCrypt.encrypt(password, iv, cleardata)
cipher = OpenSSL::Cipher.new('AES-256-CBC')
cipher.encrypt # set cipher to be encryption mode
cipher.key = password
@nickcheng
nickcheng / appdocdir.zsh
Last active May 15, 2023 15:28
Open your app's Documents folder on iOS simulator.
function myappdocdir() {
devid=$(xcrun simctl list devices | grep Booted | sed -n 's/^.*\([A-F0-9]\{8\}-\([A-F0-9]\{4\}-\)\{3\}[A-F0-9]\{12\}\).*$/\1/p')
for folder in ~/Library/Developer/CoreSimulator/Devices/$devid/data/Containers/Data/Application/*; do
if [[ -a $folder/.com.apple.mobile_container_manager.metadata.plist ]]; then
if [[ 'com.apple.phone' = $(/usr/libexec/PlistBuddy -c 'Print :MCMMetadataIdentifier' $folder/.com.apple.mobile_container_manager.metadata.plist) ]]; then
echo $folder
break
fi
fi
done
@aparrish
aparrish / understanding-word-vectors.ipynb
Last active April 9, 2025 14:04
Understanding word vectors: A tutorial for "Reading and Writing Electronic Text," a class I teach at ITP. (Python 2.7) Code examples released under CC0 https://creativecommons.org/choose/zero/, other text released under CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@klemenzagar91
klemenzagar91 / MulticastDelegateV2.swift
Created June 22, 2017 12:16
Multicast Delegate with hash table
class MulticastDelegate <T> {
private let delegates: NSHashTable<AnyObject> = NSHashTable.weakObjects()
func add(delegate: T) {
delegates.add(delegate as AnyObject)
}
func remove(delegate: T) {
for oneDelegate in delegates.allObjects.reversed() {
if oneDelegate === delegate as AnyObject {
@Erkened
Erkened / ScrollViewExample+TextField.swift
Last active February 17, 2020 05:16
UIScrollView example, with a textfield that's not covered when the keyboard appears, fully programmatic with AutoLayout. Swift 4.0
//
// ViewController.swift
// Repnote
//
// Created by John Neumann on 05/07/2017.
// Copyright © 2017 Audioy. All rights reserved.
//
import UIKit
@loretoparisi
loretoparisi / MusicPlayerManager.swift
Created July 14, 2017 09:10
Ambiguous use of play of MPMusicPlayerController in iOS11, swift4 - Apple Example "Adding Content to Apple Music"
/*
See LICENSE folder for this sample’s licensing information.
Abstract:
The `MusicPlayerManager` manages the media playback using the `MPMusicPlayerController` APIs.
*/
import UIKit
import MediaPlayer
@SheldonWangRJT
SheldonWangRJT / Convert .mov or .MP4 to .gif.md
Last active April 23, 2025 02:00
Convert Movie(.mov) file to Gif(.gif) file in one command line in Mac Terminal

This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

Need

Convert .mov/.MP4 to .gif

Reason

As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.

This is not limited to developer, anyone has this need can use this method to convert the files.

@PARC6502
PARC6502 / OpenSourceBaas.md
Last active April 22, 2025 13:43
List of open source, self hosted BaaS - Backend as a service

Backend as a Service

Supabase - ~52K stars

  • Designed explicitly as an open source firebase alternative
  • Typescript based
  • Docker support

Appwrite - ~32K stars

  • Written in JavaScript and PHP
  • Docker based
  • Realtime support across all services
@mshafer
mshafer / ContentView.swift
Last active October 11, 2024 13:00
Slide-over card (like in Maps or Stocks) using SwiftUI
import SwiftUI
struct ContentView : View {
var body: some View {
ZStack(alignment: Alignment.top) {
MapView()
SlideOverCard {
VStack {
CoverImage(imageName: "maitlandbay")
Text("Maitland Bay")
@IsaacXen
IsaacXen / README.md
Last active April 12, 2025 01:49
(Almost) Every WWDC videos download links for aria2c.