Skip to content

Instantly share code, notes, and snippets.

View Critter's full-sized avatar

Critter Critter

View GitHub Profile
@Critter
Critter / magical_record.m
Created June 28, 2013 14:09
Save localcontext using Magical Record
[localContext MR_saveToPersistentStoreWithCompletion:^(BOOL success, NSError *error) {
if (!success)
{
NSLog(@"Error: %@", [error description]);
}
else
{
NSLog(@"SAVED");
}
}];
@Critter
Critter / prepareForSeque
Created June 29, 2013 03:32
passing an object using a seque
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
// Make sure your segue name in storyboard is the same as this line
if ([[segue identifier] isEqualToString:@"YOUR_SEGUE_NAME_HERE"])
{
// Get reference to the destination view controller
YourViewController *vc = [segue destinationViewController];
// Pass any objects to the view controller here, like...
[vc setMyObjectHere:object];
@Critter
Critter / FCPrivateBatteryStatus.m
Created January 30, 2016 00:36
How to get raw battery info (mAh remaining, etc.) from iOS using private APIs. For internal testing only, NOT APP STORE DISTRIBUTION!
#import <Foundation/Foundation.h>
#include <dlfcn.h>
NSDictionary *FCPrivateBatteryStatus()
{
static mach_port_t *s_kIOMasterPortDefault;
static kern_return_t (*s_IORegistryEntryCreateCFProperties)(mach_port_t entry, CFMutableDictionaryRef *properties, CFAllocatorRef allocator, UInt32 options);
static mach_port_t (*s_IOServiceGetMatchingService)(mach_port_t masterPort, CFDictionaryRef matching CF_RELEASES_ARGUMENT);
static CFMutableDictionaryRef (*s_IOServiceMatching)(const char *name);
@Critter
Critter / Workupload Ad-Block Removal.user.js
Last active April 30, 2016 13:41
UserScript to remove the Ad-Block Blocking from workupload.com
// ==UserScript==
// @name Workupload Ad-Block Removal
// @namespace http://tampermonkey.net/
// @version 0.8
// @description Removes the sad crying girl that blocks workupload.com when ad-block is active
// @author Critter
// @match http://tampermonkey.net/index.php?version=4.0&ext=dhdg&updated=true
// @grant none
// @include http://workupload.com/*
// @include http://www.workupload.com/*
@Critter
Critter / func.php
Created April 26, 2017 14:53
function to add phone number to tickets pro export and split out customer name
function attendee_export_add_phone_split_name( $items ) {
$count = 0;
foreach ( $items as &$attendee_record ) {
// Add the header columns
if ( 1 === ++$count ) {
$attendee_record[] = 'First Name';
$attendee_record[] = 'Last Name';
$attendee_record[] = 'Phone';
}
@Critter
Critter / functions.php
Created September 26, 2017 20:32 — forked from cliffordp/functions.php
Event Tickets Plus and WooCommerce: Set child input based on forced quantity sync with parent input.
<?php
/**
* Event Tickets Plus and WooCommerce:
* Set child input based on forced quantity sync with parent input.
*
* You need to edit the product IDs (1129 parent and 1128 child in this example code)
*
* From https://gist.github.com/cliffordp/5a769159a2bf64f0b1b1dbbde243d109
* GIF preview: https://cl.ly/1F1N0h211b1w
*
@Critter
Critter / ticketsplus_woocommerce-products.php
Created September 26, 2017 20:37 — forked from theeventscalendar/ticketsplus_woocommerce-products.php
Allows customers to access the WooCommerce product page for tickets with Tickets Plus
<?php
/*
* Causes WooCommerce Ticket product pages to stop redirecting to their event page
* See https://theeventscalendar.com/knowledgebase/selling-tickets-from-the-woocommerce-products-page/
*/
function tribe_wootix_no_hijack() {
if ( ! class_exists( 'Tribe__Tickets_Plus__Commerce__WooCommerce__Main' ) ) return;
$woo_tickets = Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance();
remove_filter( 'post_type_link', array( $woo_tickets, 'hijack_ticket_link' ), 10, 4 );
<?php
tribe_get_template_part( 'wootickets/tickets', null, array(
'tickets' => Tribe__Events__Tickets__Tickets::get_all_event_tickets( get_the_ID() )
) );
?>
@Critter
Critter / pushover.py
Created July 11, 2014 19:33
SABNzbd script to push notifications to pushover
#!/usr/bin/python
import httplib, urllib, sys
message = "Download of " + sys.argv[3] + " "
serverurl = "$sabserver"
print("Converting argument " + sys.argv[7] + " to status.")
if(int(sys.argv[7]) == 0):
message = "Download of " + sys.argv[3] + " has been completed."
Critter:~ critter$ mdls /Applications/Transmit.app/
_kMDItemDisplayNameWithExtensions = "Transmit.app"
_kMDItemRenderData = <09000000 407477c0 41000c>
kMDItemAlternateNames = (
"Transmit.app"
)
kMDItemContentCreationDate = 2018-05-31 21:15:56 +0000
kMDItemContentCreationDate_Ranking = 2018-05-31 00:00:00 +0000
kMDItemContentModificationDate = 2018-06-02 12:56:24 +0000
kMDItemContentType = "com.apple.alias-file"