Skip to content

Instantly share code, notes, and snippets.

View reejosamuel's full-sized avatar

Reejo Samuel reejosamuel

View GitHub Profile
@dmsl1805
dmsl1805 / SnakeCase.swift
Last active September 3, 2023 16:11 — forked from ivanbruel/SnakeCase.swift
Camel case to snake case in Swift
extension String {
func snakeCased() -> String? {
let pattern = "([a-z0-9])([A-Z])"
let regex = try? NSRegularExpression(pattern: pattern, options: [])
let range = NSRange(location: 0, length: count)
return regex?.stringByReplacingMatches(in: self, options: [], range: range, withTemplate: "$1_$2").lowercased()
}
}
@indiesquidge
indiesquidge / subdomain-localhost-rails-5.md
Created January 19, 2016 07:42
how to access subdomains locally with Rails 5

Subdomaining Localhost with Rails 5

I've been following this blog post on how to set up an api-only Rails 5 application. One of the sections talks about creating a subdomain for your api

Rails.application.routes.draw do
  constraints subdomain: "api" do
    scope module: "api" do
@ToeJamson
ToeJamson / 1.bash
Created May 4, 2015 19:12
Tracking Location Data for iOS w/ Swift and MapKit
$ pod init
$ {your favorite editor} Podfile
#
# 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/
#
git=`sh /etc/profile; which git`
appBuild=`"$git" rev-list --all |wc -l`
if [ $CONFIGURATION = "Debug" ]; then
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
@j-mcnally
j-mcnally / UINavigationBar+DarkTint.h
Created October 15, 2013 06:19
Swizzle Color Transparent
//
// UINavigationBar+DarkTint.h
//
// Created by Justin McNally on 10/15/13.
//
//
#import <UIKit/UIKit.h>
@interface UINavigationBar (DarkTint)
@mmorey
mmorey / .gitignore
Last active November 9, 2018 16:20 — forked from adamgit/.gitignore
.gitignore file for Xcode5
#########################
# .gitignore file for Xcode5
#
# NB: if you are storing "built" products, this WILL NOT WORK,
# and you should use a different .gitignore (or none at all)
# This file is for SOURCE projects, where there are many extra
# files that we want to exclude
#
# For updates, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
# and https://gist.github.com/adamgit/3786883
@tomoyukiinoue
tomoyukiinoue / 00_prepare
Created October 14, 2012 04:08
Install Rails 3.2.8 for Mac OS X Mountain Lion (10.8.2)
1. Install Xcode 4.5.1 from AppStore.
1. Install Command Line Tools via Xcode preferences.
@mmalawski
mmalawski / 10.8 Rails Development Environment
Created October 7, 2012 14:20
Mac OSX Mountain Lion guide to installing Ruby,Rails,MySQL,Mon
# Mac OSX Mountain Lion
# Ruby on Rails Development Environment
# RVM
curl -L https://get.rvm.io | bash -s stable && rvm install 1.9.3 && rvm install 1.8.7
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
source ~/.bash_profile
# Disable rarely used RDOC
@higaki
higaki / .irbrc
Created June 29, 2012 11:12
.irbrc
# -*- ruby -*-
require 'rubygems'
require 'irb/completion'
IRB.conf[:SAVE_HISTORY] = 65535
IRB.conf[:AUTO_INDENT] = true
def ri(keywd = '')
print `ri #{keywd}`
end