Skip to content

Instantly share code, notes, and snippets.

@palaniraja
palaniraja / ObsidianCode.xccolortheme
Last active Jul 14, 2021
ObsidianCode.xccolortheme
View ObsidianCode.xccolortheme
<?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>DVTConsoleDebuggerInputTextColor</key>
<string>0.940272 0.948094 0.807674 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>JetBrainsMono-Bold - 14.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>0.940272 0.948094 0.807674 1</string>
View San Jose.xccolortheme
<?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>DVTConsoleDebuggerInputTextColor</key>
<string>1 1 1 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>SFMono-Bold - 11.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>1 1 1 1</string>
@palaniraja
palaniraja / apple-feedback-assitant.js
Created May 18, 2021
Apple Feedback assistant - printer friendly style
View apple-feedback-assitant.js
document.querySelector('div[class^="FeedbackResponse"]').style.display='none';
document.querySelector('aside').style.display='none';
document.querySelector('div[class^="Wrapper-sc"]').style.height='auto';
document.querySelector('nav').style.display='none';
document.querySelector('div[class^="Body"]').style.position='inherit';
@palaniraja
palaniraja / minbit.java
Created Oct 1, 2020
min. bit flip reqd
View minbit.java
class Main
{
public static void main(String args[])
{
int[] prbArray = new int[]{ 0,0,0,1,0,1,0,1,1,1 };
Solution prb = new Solution();
System.out.println(prb.solution(prbArray));
}
}
@palaniraja
palaniraja / ios-build-icon.sh
Created Jul 25, 2020
update app icon with country code and git revcount
View ios-build-icon.sh
imgBuild="DE" && imgBuildNumer=`git rev-list --count HEAD` &&
imgPath="SRCDIR/Assets/Images.xcassets/AppIcon.appiconset" &&
convert "$imgPath/Icon-60@2x(120x120).png" -fill black -pointsize 22 -gravity North -annotate 0 "$imgBuild $imgBuildNumer" "$imgPath/Icon-60@2x(120x120).png" &&
convert "$imgPath/Icon-60@3x(180x180).png" -fill black -pointsize 26 -gravity North -annotate 0 "$imgBuild $imgBuildNumer" "$imgPath/Icon-60@3x(180x180).png" &&
convert "$imgPath/Icon-Small@3x(87x87).png" -fill black -pointsize 22 -gravity North -annotate 0 "$imgBuild" "$imgPath/Icon-Small@3x(87x87).png" &&
convert "$imgPath/Icon-Small@2x(58x58).png" -fill black -pointsize 22 -gravity North -annotate 0 "$imgBuild" "$imgPath/Icon-Small@2x(58x58).png"
@palaniraja
palaniraja / .zshrc
Last active Jul 23, 2020
fzf - to search history
View .zshrc
fh() {
print -z $( ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s --tac --height "40%" | sed -E 's/ *[0-9]*\*? *//' | sed -E 's/\\/\\\\/g')
}
# and try fh to filter the history with fzf
# source: https://armno.in.th/2020/01/16/fzf-history/
@palaniraja
palaniraja / jira.js
Created Jul 17, 2020
JIRA - linked lists as text
View jira.js
document.querySelectorAll('.links-list .link-content').forEach(el => {
console.log(el.querySelector('span').innerText)
})
@palaniraja
palaniraja / sync.swift
Created Jun 13, 2020
Synchronous urlrequests with delays in between, and skip/break if found
View sync.swift
import UIKit
struct Todo: Codable {
let userId: Int
let id: Int
let title: String
var completed: Bool
}
var todos = [Todo]()
@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