Skip to content

Instantly share code, notes, and snippets.

View LunaCodeGirl's full-sized avatar

Luna Comerford LunaCodeGirl

View GitHub Profile
{
"cmd": ["bash", "-c", "clang -lobjc -framework Cocoa -framework Carbon -o /tmp/sublime-objc-output $file"],
"file_regex": "^(.*?):([0-9]+):([0-9]+): (.*)",
"selector": "source.objc",
"variants": [
{
"name": "Run",
"cmd": ["bash", "-c", "clang -lobjc -framework Cocoa -framework Carbon -o /tmp/sublime-objc-output $file && /tmp/sublime-objc-output"]
}
]
@LunaCodeGirl
LunaCodeGirl / wp-config.php
Created September 25, 2013 23:28
Wordpress updater / uploader constants to set default user, pass, key, host, etc.
define('FTP_PUBKEY','/home/user1/wp_rsa.pub');
define('FTP_PRIKEY','/home/user1/wp_rsa');
define('FTP_USER','user1');
define('FTP_PASS','');
define('FTP_HOST','127.0.0.1:22');
@LunaCodeGirl
LunaCodeGirl / examples.sh
Created September 25, 2013 23:39
Figlet how to and examples
figlet "I've got something to say"
figlet -f thick "Make Tech ASCIIer"
date | figlet -f basic
// Change the columns for the edit CPT screen
function change_columns( $cols ) {
$cols = array(
'cb' => '<input type="checkbox" />',
'url' => __( 'URL', 'trans' ),
'referrer' => __( 'Referrer', 'trans' ),
'host' => __( 'Host', 'trans' ),
);
return $cols;
}

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command

Open/Goto


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods
@LunaCodeGirl
LunaCodeGirl / Objective-C Runtime OS Version Check
Last active June 29, 2017 09:07
Macros for determining system version number in Objective-c for iPhone/iPad/iOS apps.
/*
* System Versioning Preprocessor Macros
*/
#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)
@LunaCodeGirl
LunaCodeGirl / acl examples
Created November 19, 2013 23:08
Some examples of unix ACLs
There are two types of ACLs: access ACLs and default ACLs. An access ACL is the access control list for a specific file or directory. A default ACL can only be associated with a directory; if a file within the directory does not have an access ACL, it uses the rules of the default ACL for the directory. Default ACLs are optional.
ACLs can be configured:
1. Per user
2. Per group
3. Via the effective rights mask
4. For users not in the user group for the file
The setfacl utility sets ACLs for files and directories. Use the -m option to add or modify the ACL of a file or directory:
setfacl -m <rules> <files>
Rules (<rules>) must be specified in the following formats. Multiple rules can be specified in the same command if they are separated by commas.
u:<uid>:<perms>
@LunaCodeGirl
LunaCodeGirl / Rails Model Datatypes
Created December 11, 2013 01:05
This shows all of the datatypes that the rails models can use.
Here are all the Rails 4 (ActiveRecord migration) datatypes:
• :binary
• :boolean
• :date
• :datetime
• :decimal
• :float
• :integer
• :primary_key
• :references
@LunaCodeGirl
LunaCodeGirl / HexadecimalColorRegex
Created February 1, 2014 01:43
Regex for validating hexadecimal color codes.
^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
^ #start of the line
# # must constains a "#" symbols
( # start of group #1
[A-Fa-f0-9]{6} # any strings in the list, with length of 6
| # ..or
[A-Fa-f0-9]{3} # any strings in the list, with length of 3
) # end of group #1
#!/bin/sh
# Script for managing build and version numbers using git and agvtool.
# Change log:
# v1.0 18-Jul-11 First public release.
# v1.1 29-Sep-12 Launch git, agvtool via xcrun.
version() {