Skip to content

Instantly share code, notes, and snippets.

View jawwad's full-sized avatar

Jawwad Ahmad jawwad

View GitHub Profile
#!/usr/bin/env python
import argparse
from email.policy import default
import os
import pathlib
import re
import shutil
import subprocess
import sys
/* ~/Library/KeyBindings/DefaultKeyBinding.dict */
// curl -o 'https://gist.githubusercontent.com/jawwad/4461d8a27747b8561bc758b119b1e967/raw' -o ~/Library/KeyBindings/DefaultKeyBinding.dict
// wget 'https://gist.githubusercontent.com/jawwad/4461d8a27747b8561bc758b119b1e967/raw' -O ~/Library/KeyBindings/DefaultKeyBinding.dict
// quit app for change to take effect
{
"~f" = "moveWordForward:";
"~b" = "moveWordBackward:";
"~d" = "deleteWordForward:";
"~F" = "moveWordRightAndModifySelection:"; /* ~$f or $~f doesn't work */
"~B" = "moveWordLeftAndModifySelection:";
import Foundation
let session = NSURLSession.sharedSession()
let requestIsBeingHandledKey = "RequestIsBeingHandledKey"
class CustomNSURLProtocol: NSURLProtocol {
override class func canInitWithRequest(request: NSURLRequest) -> Bool {
if NSURLProtocol.propertyForKey(requestIsBeingHandledKey, inRequest: request) != nil {
return false // Prevent recursize loop
@jawwad
jawwad / gist:43002afe74fc74d2e9f5
Created June 24, 2015 13:22
Xcode Build Phase Run script
SCRIPT_LOCATION='/usr/local/bin/swiftlint'
VIOLATIONS_TO_IGNORE="\
Length|\
Force Cast|\
Name Format|\
TODO or FIXME"
if [ -e $SCRIPT_LOCATION ] ; then
$SCRIPT_LOCATION | grep -Ev "($VIOLATIONS_TO_IGNORE) Violation"
#!/usr/bin/env ruby
require 'colorize'
PROJECT_NAME = 'provide'
PROJECT_BUILD_COMMAND = "xcodebuild -workspace #{PROJECT_NAME}.xcworkspace -scheme #{PROJECT_NAME} > /dev/null"
ALL_SWIFT_FILES = Dir["#{PROJECT_NAME}/**/*.swift"]
def main
# checks_to_perform = [
import UIKit
class BaseGrid {
init() {
initGrid()
}
// Subclasses override this function
func initGrid() {
println("Superclass")
@jawwad
jawwad / sourcetree_custom_actions_open_on_github.rb
Created March 25, 2015 03:48
SourceTree Custom Actions to open the selected FILE, SHA, or REPO on github.com
#!/usr/bin/env ruby
## Setup the following Custom Actions in SourceTree preferences in order
## to easily open a FILE or commit SHA in a browser on github.com
# No need to checkmark "Open in Separate Window" or "Show in Full Output"
# Menu Caption: Open SHA on github.com
# Script to run: ~/path/to/this_script.rb
# Parameters: $SHA
@jawwad
jawwad / 0_reuse_code.js
Created August 14, 2014 15:29
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jawwad
jawwad / databases.rake
Last active August 29, 2015 14:00 — forked from wbailey/databases.rake
Make 'databases.yml' singular to match Rails convention
require 'yaml'
require 'logger'
require 'active_record'
namespace :db do
def create_database config
options = {:charset => 'utf8', :collation => 'utf8_unicode_ci'}
create_db = lambda do |config|
ActiveRecord::Base.establish_connection config.merge('database' => nil)
source 'https://rubygems.org'
gem 'rails', '3.1.0'
gem 'haml'
group :development, :test do
gem 'ruby-debug19'
end