Skip to content

Instantly share code, notes, and snippets.

palaniraja palaniraja

Block or report user

Report or block palaniraja

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@palaniraja
palaniraja / Log.swift
Created May 23, 2020
Conditional logging to strip logs in release builds
View Log.swift
#if DEBUG
class Log {
static func d(_ str: String){
print("Log.d: \(str)")
}
}
#else
class Log {
static func d(_ str: String) { }
}
@palaniraja
palaniraja / NSLocale+Util.swift
Created May 23, 2020
Overriding NSLocalizedString function to print the keys used for debugging purpse
View NSLocale+Util.swift
/**
* prints the localization key and string requested in log for debugging purpose
*/
#if DEBUG
public func NSLocalizedString(_ key: String, tableName: String? = nil, bundle: Bundle = Bundle.main, value: String = "", comment: String) -> String
{
let str = bundle.localizedString(forKey: key, value: value, table: tableName)
debugPrint("DEBUG: \(key) -> \(str)")
return str
@palaniraja
palaniraja / string-queue.swift
Created May 16, 2020
circular queue of reserved capacity
View string-queue.swift
class StrQueue: NSObject {
static let shared = StrQueue()
let kQueueLength = 3
var strings = [String]()
private override init() { }
func add(_ str: String?){
@palaniraja
palaniraja / realm-to-csv.swift
Last active Apr 20, 2020
Realm entity to csv export
View realm-to-csv.swift
let obj = YourRealmEntity.sharedSchema()
let props = obj?.properties
print(props)
var csvHeader = [String]()
for pid in props as! [RLMProperty]{
// print("type:\(pid.type) name: \(pid.name)")
csvHeader.append("\(pid.name)")
}
@palaniraja
palaniraja / dispatchgroup.swift
Created Feb 1, 2020
dispatchgroup swift playground
View dispatchgroup.swift
import UIKit
print("one")
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
print("two")
}
print("three")
func testactivation(){
@palaniraja
palaniraja / .jazzy.yaml
Created Jul 3, 2019
output of "jazzy --help config" from jazzy version: 0.9.6
View .jazzy.yaml
By default, jazzy looks for a file named ".jazzy.yaml" in the source
directory and its ancestors. You can override the config file location
with --config.
(The source directory is the current working directory by default.
You can override that with --source-directory.)
The config file can be in YAML or JSON format. Available options are:
@palaniraja
palaniraja / xcode-buildconfig-delete.sh
Created Jun 26, 2019
script to delete unwanted buildconfig from xcodeproj file
View xcode-buildconfig-delete.sh
#!/bin/bash
# get these ids by "grep -B 2 buildConfigurations project.pbxproj"
targets=("040030D22004301100C4B676" "0420B3DA1FD1E91B00F66B8C" "042171FE1F7EB27500B3578D" "0421731D1F7EB3EC00B3578D" "04CD5F511FD0D1650053BE87" "3461E09E1A7BF77600B666A1" "3461E0C21A7BF77600B666A1" "A0D180071F46067500E00C0C")
# get these xcodebuild -project YOURPROJ.xcodeproj -list
configsToSkip=("us-debug" "us-debug-free" "us-release" "us-release-free" )
@palaniraja
palaniraja / pdf2png.wflow
Created Jun 24, 2019
PDF to PNG - OSX Automator - Finder workflow
View pdf2png.wflow
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AMApplicationBuild</key>
<string>444.42</string>
<key>AMApplicationVersion</key>
<string>2.9</string>
<key>AMDocumentVersion</key>
<string>2</string>
@palaniraja
palaniraja / out.html
Last active Mar 12, 2019
Find all the files changed between two commits and cumulated commit messages per file
View out.html
<html><head><style>td{white-space: pre;}</style></head><body><table border=1>
<tr>
<td>File: (file1.txt)</td>
<td>
5755793 commit from master (correct this time)
322afb2 file 1 modified, and to be tagged as v1
</td></tr>
<tr>
<td>File: (file2.txt)</td>
@palaniraja
palaniraja / alias.sh
Created Nov 12, 2018
alias - alias from my work machine to refer later (ohmyzsh + few custom)
View alias.sh
-='cd -'
...=../..
....=../../..
.....=../../../..
......=../../../../..
1='cd -'
2='cd -2'
3='cd -3'
4='cd -4'
5='cd -5'
You can’t perform that action at this time.