Skip to content

Instantly share code, notes, and snippets.

View JohannMG's full-sized avatar
🐺

Johann Garces JohannMG

🐺
View GitHub Profile
@JohannMG
JohannMG / conversion-social.js
Last active May 19, 2019 15:58
Quick JS for FB conversion Pixel. No duplicate conversion pixel firing.
/*
fires on checkout THANK YOU page on a successful transaction
behavior:
checks if facebook tracking pixel is initiliazed
if not: waits 200ms
then, calls facebook FBQ
get data via:
transactionfield: {total: 156.69, ordernum: "22"}
@JohannMG
JohannMG / cart_shortcode.php
Created December 9, 2015 16:47
Add a wordpress shortcode that pulls cart count.
add_shortcode('cart_count', 'cart_count_sc');
function cart_count_sc ($atts){
$total = WC()->cart->cart_contents_count;
return '<span class="cart-count">'. $total . '</span>';
}
@JohannMG
JohannMG / OCRIntegration.md
Last active February 11, 2016 15:28
OCR View Notes and Doc

#OCR Integration Notes

Library Dependencies:

  • [Tesseract OCR iOS]
  • [GPUImage]

Main OCR Files structure

-Curves non-ARC objective-c code must have appropriate compiler flags -Filters

// >:D
var fns = Array< (String?) -> Bool >()
fns.append( {( input: String?) -> Bool in
return input == "hello"
})
fns.append { (input: String?) -> Bool in
return input == ""
}
@JohannMG
JohannMG / Fixxcodemerge.sh
Last active February 16, 2016 19:08
Thanks to Kendall Helmstetter Gelner on SO for this script to clean up the xcode project after a merger
#!/bin/sh
projectfile=`find -d . -name 'project.pbxproj'`
projectdir=`echo *.xcodeproj`
projectfile="${projectdir}/project.pbxproj"
tempfile="${projectdir}/project.pbxproj.out"
savefile="${projectdir}/project.pbxproj.mergesave"
cat $projectfile | grep -v "<<<<<<< HEAD" | grep -v "=======" | grep -v "^>>>>>>> " > $tempfile
cp $projectfile $savefile
//: Playground - noun: a place where people can play
import UIKit
import XCPlayground
var str = "Hello, playground"
extension UIView {
@JohannMG
JohannMG / usingCodeCommitAWS.md
Last active December 28, 2023 05:42
Setting Up AWS CodeCommit (Mac) with Sourcetree and disabling keychain

#Setting Up AWS CodeCommit (Mac)

For all possibilities, amazon has guides here: http://docs.aws.amazon.com/codecommit/latest/userguide/setting-up.html

We chose to use HTTPS here

If git asks you to manually enter username or password it is incorrectly configured!

Similar to RSA, the AWS CLI credential-helper should be using your keys to create and send a dynamic password that updates every 15 minutes.

//: Playground - noun: a place where people can play
import UIKit
import XCPlayground
var str = "Hello, playground"
let mainView = UIView (frame: CGRect(x: 0, y: 0, width: 300, height: 300))
mainView.backgroundColor = UIColor(red: 0.74, green: 1.00, blue: 0.91, alpha: 1.00)
XCPlaygroundPage.currentPage.liveView = mainView
@JohannMG
JohannMG / AddHeader.py
Created May 5, 2016 21:12
Python script to add header file to all files in a library. (This may be the worst thing I've done in a while... But it got the build working!)
def appendWithImport(filename):
with open (filename, "r+") as file:
original = file.read()
file.seek(0,0)
file.write("@import Foundation; \n" + original)
files = [
"ZXingObjC-modified/aztec/decoder/ZXAztecDecoder.h",
@JohannMG
JohannMG / PasringJsonIntoStructs.swift
Created May 9, 2016 18:53
More organized way to collect JSON-parsed variables. Similar to JAVA's BSON where you file it into an object.
//: Playground - noun: a place where people can play
/**
More organized way to collect JSON-parsed variables.
Similar to JAVA's GSON where you file it into an object with known types and methods.
Best to run it in a SwiftPlayground
*/
import Foundation
let originalJSONString = "{\"id\":234789,\"State\":\"California\",\"ArrayEx\":[\"element1\",\"element2\"]}"