Skip to content

Instantly share code, notes, and snippets.

@anjerodesu
anjerodesu / sample.json
Last active June 18, 2021 03:02
sample json data
{
"uID": "0",
"firstName": "Juan",
"middleName": "",
"lastName": "dela Cruz",
"homeAddress": "01 Fake Street Espania, Manila City, Philippines",
"mobileNumber": "09171234567",
"email": "juandelacruz@gmail.com",
"birthday": "01/01/1991",
"gender": "1",
@anjerodesu
anjerodesu / Anchor.swift
Created June 4, 2016 05:47
NSLayoutAnchor for 10.10/iOS8
//
// Anchor.swift
// AnchorTest
//
// Created by Jonathan Wight on 7/10/15.
// Copyright © 2015 schwa.io. All rights reserved.
//
#if os(OSX)
import AppKit
#
# Set the build number to the current git commit count.
# If we're using the Dev scheme, then we'll suffix the build
# number with the current branch name, to make collisions
# far less likely across feature branches.
# Based on: http://w3facility.info/question/how-do-i-force-xcode-to-rebuild-the-info-plist-file-in-my-project-every-time-i-build-the-project/
#
# Updated with dSYM handling from http://yellowfeather.co.uk/blog/auto-incrementing-build-number-in-xcode-revisited/
#
extension String {
static func random(length: Int) -> String {
let base = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
var randomString: String = ""
for _ in 0..<length {
let randomValue = Int.random(from: 0, to: base.characters.count)
randomString.append(base[base.startIndex.advancedBy(randomValue)])
}
string trmwsp(string s) {
if (strlen(s) < 1) {
return empstr();
}
while (isspace(*s)) s++;
if (*s == 0) {
return empstr();
@anjerodesu
anjerodesu / todo.sh
Last active May 25, 2016 03:33
Run Script that converts certain keywords into a shell warning.
KEYWORDS="TODO:|FIXME:|REMINDER:|\?\?\?:|\!\!\!:"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | perl -p -e "s/($KEYWORDS)/ warning: \$1/"
@anjerodesu
anjerodesu / build.sh
Created February 26, 2014 09:48
Auto increment build number
#!/bin/bash
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"
@anjerodesu
anjerodesu / README.md
Created March 1, 2013 10:42
A comprehensive script for Xcode projects that lets you generate .gitignore and .gitattributes in the directory of your choosing.

Generate Git

A comprehensive script for Xcode projects that lets you generate .gitignore and .gitattributes in the directory of your choosing.

Running the script

  • Copy the script to your project folder.
  • Open Terminal and run:
    • cd path/to/your/project/ (if you're not yet on your project's directory)
  • sh generate-git.sh
<?php
/********************************************************************************************/
/* HTMLSpecialEntity created by Angelo Villegas [http://www.studiovillegas.com] */
/* */
/* Copyright © Angelo Villegas */
/* 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 */
@anjerodesu
anjerodesu / UPPEValidator.php
Last active December 10, 2015 22:29
UPPEValidator is a simple PHP class that will help validate email addresses, URLs, passwords, and phone numbers.
<?php
/********************************************************************************************/
/* UPPEValidator created by Angelo Villegas [http://www.studiovillegas.com] */
/* */
/* Copyright © Angelo Villegas */
/* 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 */