Skip to content

Instantly share code, notes, and snippets.

View rismay's full-sized avatar
🏠
Working from home

Cristian A Monterroza rismay

🏠
Working from home
View GitHub Profile
#!/usr/bin/perl
use Mysql;
use strict;
use vars qw($school_name);
use vars qw($pass);
require "./cgi-lib.pl";
@rismay
rismay / iOS Backgrounding
Last active December 28, 2015 10:39
This code makes your iOS app run indefinitely in the background. Copy and paste the below methods into a singleton / manager which handles the tasks you need to perform in the background.
// @interface
// Declare Private property
@property (nonatomic) UIBackgroundTaskIdentifier backgroundTask;
//@end
// ...
// Copy into
//@implementation
@rismay
rismay / SingletonMacro
Created November 24, 2013 03:11
Easy singleton. Add this to your PCH and every class will be singletonable. Exercise caution.
#define WSM_SINGLETON_WITH_NAME(sharedInstanceName) \
+ (instancetype) sharedInstanceName { \
static id sInstance; \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
sInstance = [[self alloc] init]; \
}); \
return sInstance; \
} \
@rismay
rismay / BumpVersionNumber
Last active December 30, 2015 17:39
This script bumps the version and build number every time you build and there has been a change to files in the build directory. The version and build numbers are the same. The Marketing Version is simply the build number / 100. The build number is displayed in Hex. To get this started: In your project settings put 0.00 in your version field and…
#!/bin/bash
if [ -n "$(find "$PROJECT_DIR" \! -path "*xcuserdata*" \! -path "*.git" -newer "$INFOPLIST_FILE")" ]; then
versionNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "$INFOPLIST_FILE")
versionNumber=`echo $versionNumber +0.01|bc`
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $versionNumber" "$INFOPLIST_FILE"
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
buildNumber=$((0x$buildNumber))
buildNumber=$(($buildNumber + 1))
buildNumber=$(printf "%X" $buildNumber)
@rismay
rismay / WSMMacros.h
Created January 25, 2014 20:13
Lazy Instantiation as a C MACRO
//You should pick one style to use consistantly in your project
//Lazy Intantiation as a C Macro clearly explaining the concept
#define WSM_LAZY(variable, assignment) (variable = variable ?: assignment)
//Lazy Intantiation as a C Macro clearly explaining the language syntax used
#define WSM_TERNARY(variable, assignment) (variable = variable ?: assignment)
//Lazy Intantiation as a semi-operator w/class prefix
#define WSM_$(variable, assignment) (variable = variable ?: assignment)
@rismay
rismay / git_commit_fix
Last active August 29, 2015 13:59
Fix Git Commit Authorship
git filter-branch -f --env-filter "GIT_AUTHOR_NAME='Cristian A Monterroza'; GIT_AUTHOR_EMAIL='cmonterroza@wrkstrm.me'; GIT_COMMITTER_NAME='Cristian A Monterroza'; GIT_COMMITTER_EMAIL='cmonterroza@wrkstrm.me';" HEAD
# template.rb
#-------------------
## GEMS
#-------------------
gem 'bcrypt'
gem 'pry-rails'
gem_group :development do
@rismay
rismay / _.md
Created May 24, 2014 22:45
SO stacked bar chart with padding
@rismay
rismay / _.md
Created May 25, 2014 05:48
Tributary inlet
@rismay
rismay / _.md
Created May 26, 2014 04:44
static svg logo