Skip to content

Instantly share code, notes, and snippets.

View JohannMG's full-sized avatar
🐺

Johann Garces JohannMG

🐺
View GitHub Profile
from moviepy.editor import VideoFileClip
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip
import os.path
import sys
import time
import math
def main(args):
clipCount = 0
# # clip = VideoFileClip("/Users/johannmg/localdev/LiveVidSnipets/recordin/2019-11-04_18-56-06.flv")
@JohannMG
JohannMG / DiceProblem.swift
Created June 2, 2017 21:47
Dice that hit a 5 or 6 can be re-rolled to doubled-down. Three dice are rolled. What's the the probability of getting 2 or more total points.
//: Playground - noun: a place where people can play
import Cocoa
/*
Problem: There are three dice.
It counts as a point if any die hits a 5 or 6
Any die that gets a 5 ot 6 is rolled again. If the second roll is 5 ot 6 that die has produced two points.
*/
@JohannMG
JohannMG / EmojiStrings.swift
Last active May 2, 2017 16:23
Playground figuring out emoji String encoding.
//: Playground - noun: a place where people can play
import UIKit
extension Character
{
func unicodeScalarCodePoint() -> String
{
let characterString = String(self)
@JohannMG
JohannMG / CollectionOnlyType.swift
Created May 2, 2017 00:02
I write this so much. Saved.
import Foundation
extension Collection {
func onlyType<T>(_ type: T.Type) -> [T] {
return self.filter{ $0 is T }.map{ $0 as! T }
}
}

Make A CCMFramework Build inside AAAMobile.

Version update

if needed

  • Update Version Number in CCMVersion.swift
  • Update Version Number in CCMFramework.h comments/header
  • Update Version Number in info.plist info.plist update
@JohannMG
JohannMG / HackernewsYouCanUse.css
Created March 24, 2017 20:12
Injectable CSS for Hacker News. Better to read. Removes comment box to retain sanity.
table#hnmain {max-width: 800px !important;background-color: #fff !important;}a.storylink {color: #000 !important;}tr.spacer {height: 10px !important;}span.rank {color: #9c9c9c !important;display: none !important;}.votearrow {display: none !important;}span.sitestr {color: #409021 !important;}span.score {display: none !important;}textarea {display: none !important;}input[type="submit"] {display: none !important;}form {display: none !important;}
@JohannMG
JohannMG / RemoveMantleFromSnapsheet.sh
Created February 9, 2017 21:48
Strip Mantle Script
#!/bin/sh
#HOW TO USE
# Get architectures with
# $ lipo -info SnapsheetSDK
# Run the script in the same dir as the binary (binary name in this case is SnapsheetSDK)
# Run script with archs are parameters
# $ ./strip_symbols.sh SnapsheetSDK armv7 armv7s i386 x86_64 arm64
@JohannMG
JohannMG / URLReponseWrapper.swift
Created February 9, 2017 20:44
Response object representing the response from the server. Quick JSON parsing so you stop repeating the snippet
/*
Response object representing the response from the server.
Core: Data (NSData), Response (NSURLResponse), Error (NSError)
Convienece:
HTTP
JSON (Meant for an individual object)
JSON Array (Meant for parsing an entire list of objects)
*/
struct Response {
@JohannMG
JohannMG / POIBottomPointingView.swift
Created February 9, 2017 02:43
Playground: Draws a little view with a triangle point at the center bottom pointing down.
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
class ReminderView : UIView {
let popupColor = UIColor(white: 0.0, alpha: 0.16)
let drawingCornerRadius: CGFloat = 6.0
let bubbleHeightRatio: CGFloat = 0.83
let label = UILabel()
@JohannMG
JohannMG / UIStackView-Inside-UIScrollView.swift
Last active February 8, 2017 02:25
Playground sketch in Swift 3. Not to replace a UITableView but to make a fixed stack to up and down.
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
func getMeANewView() -> UIView {
let randomHue = (Double( arc4random_uniform(101) ) - 1.0) / 100.0
let newView = UIView(frame: CGRect(x: 0, y: 0, width: 250, height: 50))
newView.backgroundColor = UIColor(hue: CGFloat(randomHue), saturation: 0.5, brightness: 0.5, alpha: 1.0)
// newView.widthAnchor.constraint(equalToConstant: 250).isActive = true