Skip to content

Instantly share code, notes, and snippets.

@CVertex
CVertex / BaseConsole.cs
Last active December 15, 2015 04:50
BaseConsole class used for simple command line interface. See the Program class below for a simple usage
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using C = System.Console;
namespace Tafe120.Console
{
/// <summary>
/// Base class for a command line interface
@CVertex
CVertex / export-devices.js
Created May 27, 2013 09:25
Extract UDIDs and Device names from Apple dev portal
// open the devices portal and run this in chrome console
var rows = $('#grid-table tr');
rows.each(function(i,val) {
var udid = $(val).find('td[aria-describedby=grid-table_deviceNumber]').html();
var name = $(val).find('td[aria-describedby=grid-table_name]').html();
console.log(udid + '\t' + name);
});
<form action="#" id="courseGuideForm" method="post">
<input type="hidden" name="X-Requested-With" value="XMLHttpRequest" />
<input type="text" name="Name" value="" />
<input type="text" name="Email" value="" />
<input type="button" class="submitButton" value="Get Your Guide Now" />
@CVertex
CVertex / search_xibs
Created March 27, 2014 07:39
Search through xibs for a string
#!/bin/sh
grep -i -r --include=*.xib "$1" .
if (ApiErrorCodeChecker.isCommon(code)) {
final boolean shouldLogout = ApiErrorCodeChecker.doesRequireLogout(code);
final boolean shouldShowMessage = ApiErrorCodeChecker.shouldShowMessage(code);
final boolean shouldGoUnderMaintenance = code == ApiErrorCode.UnderMaintenance;
if (shouldShowMessage) {
if (shouldLogout || shouldGoUnderMaintenance) {
// On pressing Ok, user should be shown the "Service unavailable" message or the user should be logged out
AlertDialogHelper.showOk(context, result.getMessage(), new OnClickListener() {
#define UA_invalidateTimer(t) [t invalidate]; t = nil;
#define UA_isIPad (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define UA_isIPhone (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define UA_isRetinaDevice ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] >= 2)
#define UA_isMultiTaskingSupported ([[UIDevice currentDevice] respondsToSelector:@selector(isMultitaskingSupported)] && [[UIDevice currentDevice] isMultitaskingSupported])
#define UA_runOnMainThread if (![NSThread isMainThread]) { dispatch_sync(dispatch_get_main_queue(), ^{ [self performSelector:_cmd]; }); return; };
@CVertex
CVertex / SplitFile.cs
Created December 8, 2014 12:37
Splitting files by line using C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using C = System.Console;
using System.IO;
using System.Net;
namespace Commands
$('.table-itc-testers tr.ng-scope').each(function(i,val) {
var el = $(val);
var email = el.find('td:nth-child(2)').find('span:first').text()
//console.log(email)
var name = el.find('td:nth-child(3)').find('span:first').text();
console.log(name + ','+email);
});
@CVertex
CVertex / extract-testflight.js
Created November 26, 2015 02:00
Extract TestFlight user email addresses from iTunes Connect
var text = '';
$('.itc-tester-view tbody tr').each(function(index, el) {
var email = el.querySelector('td:nth-child(2) span:first-child').innerText;
var name = el.querySelector('.sorted > span').innerText.split(' ');
text = text + name[0] + ', ' + name[1] + ', ' + email+'\n';
});
var a = document.createElement("a");
var file = new Blob([text], {type: 'text/csv'});
a.href = URL.createObjectURL(file);
import UIKit
struct Person {
let name: String
let city: String
}
let people = [
Person(name: "Chris", city: "Berlin"),
Person(name: "Natasha", city: "Tokyo"),