Skip to content

Instantly share code, notes, and snippets.

View palaniraja's full-sized avatar

palaniraja palaniraja

View GitHub Profile
@maplesteve
maplesteve / build.xml
Created March 10, 2013 18:35
Sample build.xml to use oclint for PMD analysis in Jenkins. See the post mentioned in the first comment for details.
<?xml version="1.0" encoding="UTF-8"?>
<project name="fooProject" default="build-fooProject">
<property environment="env"/>
<target name="build-fooProject" depends="prepare,oclint" />
<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/build/oclint" />
</target>
@NachoMan
NachoMan / DataManager.h
Created April 15, 2011 21:15
Core Data singleton manager class capable of being run from a static library
// DataManager.h
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
extern NSString * const DataManagerDidSaveNotification;
extern NSString * const DataManagerDidSaveFailedNotification;
@interface DataManager : NSObject {
}
@ElDragonRojo
ElDragonRojo / RulesFor3rdPartyFrameworks.md
Last active December 6, 2016 07:14
My rules for creating and using 3rd party frameworks (i.e. those not part of the platform's standard toolkit).

Rule 0: Do not make a framework.

Ask yourself if you should be making a framework given that you are not in the business of making frameworks. Believe it or not, most of us have the urge to solve problems completely and in the general case as our first inclination, but getting things done requires not doing so almost all of the time.

Rule 1: Do not have dependencies on other 3rd party frameworks.

Frameworks should be modular and standalone. They should require nothing but the standard system libraries in order to run. If the framework relies on other functionality, it should encompass it entirely. If it cannot, it probably violates Rule 3.

Rule 2: Use a non-viral open-source license like MIT or Apache, NOT GPL.

@mwbrooks
mwbrooks / projectAppDelegate.m
Created February 15, 2011 18:43
ON PhoneGap-iOS, open external links in the external browser (Safari.app)
/**
* Note: the following function should already exist in your application delegate file.
* Replace it with the following implementation.
*
* Thanks to @purplecabbage for implementation.
* Thanks to Ruddiger for the iFrame patch.
*/
// ...
#!/bin/bash
function usage {
echo "Usage: $0 -c [CodeSign Directory] -p [Xcode Project File.xcodeproj]"
echo "If any arguments are not specified, defaults will be attempted. If defaults don't exist, script will exit."
echo "OPTIONS:"
echo " -c [CodeSign Directory]: Location of directory containing project's provisioning profiles."
echo " -p [Xcode Project File]: Path of Xcode project directory (the .xcodeproj, not .pbxproj)"
echo " -b: Use PlistBuddy command for UUID replacement instead of sed. (Better handling of a couple of edge cases, but makes diffs impossible to read.)"
echo " -v: Verbose logging."
@trevordixon
trevordixon / xlsxParser.js
Created August 17, 2012 04:10
Parse an Excel xlsx file with javascript, jquery, and zip.js
/*
Relies on jQuery, underscore.js, Async.js (https://github.com/caolan/async), and zip.js (http://gildas-lormeau.github.com/zip.js).
Tested only in Chrome on OS X.
Call xlsxParser.parse(file) where file is an instance of File. For example (untested):
document.ondrop = function(e) {
var file = e.dataTransfer.files[0];
excelParser.parse(file).then(function(data) {
console.log(data);
@cabeca
cabeca / simulator_populator_xcode7
Last active April 16, 2020 09:18
This script removes and recreates all simulators in Xcode 7.
#!/usr/bin/env ruby
require 'JSON'
device_types = JSON.parse `xcrun simctl list -j devicetypes`
runtimes = JSON.parse `xcrun simctl list -j runtimes`
devices = JSON.parse `xcrun simctl list -j devices`
devices['devices'].each do |runtime, runtime_devices|
runtime_devices.each do |device|
@JagCesar
JagCesar / Fastfile
Created December 29, 2016 15:36
Cookin Fastfile
# Customise this file, documentation can be found here:
# https://github.com/fastlane/fastlane/tree/master/docs
# All available actions: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Actions.md
# can also be listed using the `fastlane actions` command
# Change the syntax highlighting to Ruby
# All lines starting with a # are ignored when running `fastlane`
# If you want to automatically update fastlane if a new version is available:
# update_fastlane
@cabeca
cabeca / simulator_populator
Created September 23, 2014 21:30
This script removes and recreates all simulators in Xcode 6.
#!/usr/bin/env ruby
device_types_output = `xcrun simctl list devicetypes`
device_types = device_types_output.scan /(.*) \((.*)\)/
runtimes_output = `xcrun simctl list runtimes`
runtimes = runtimes_output.scan /(.*) \(.*\) \((com.apple[^)]+)\)$/
devices_output = `xcrun simctl list devices`
devices = devices_output.scan /\s\s\s\s(.*) \(([^)]+)\) (.*)/
@eahrold
eahrold / ProcessPipe.swift
Last active October 24, 2020 17:12
pipe Process (NSTask) in swift
//
// ProcessPipe.swift
//
// Created by Eldon on 8/10/18.
// Copyright © 2018 Big Club Digital. All rights reserved.
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTIO