This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Convert from dos/unix to unix | |
#To convert from any mixture of CRLF endings and LF-only endings, to LF-only endings:[C 1] | |
:set hidden #Allow modified buffers to be hidden. | |
:set ffs=dos #Assume dos line endings (CRLF or LF-only) when reading files. | |
:args *.c *.h #Specify the files to convert. | |
:argdo set ff=unix|w #For each argument, set unix file format for the buffer, and write the file.[C 2] | |
#Convert from dos/unix to dos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git-revert $ git init | |
git-revert (master) $ touch 1.txt | |
git-revert (master) $ touch 2.txt | |
git-revert (master) $ git add . | |
git-revert (master) $ git commit -am "wanted commit 1" | |
[master (root-commit) 80395aa] wanted commit 1 | |
2 files changed, 0 insertions(+), 0 deletions(-) | |
create mode 100644 1.txt | |
create mode 100644 2.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert <your.pem> -key <your.pem> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#zsh | |
brew list | while read cask; do echo -n "\e[1;34m$cask ->\e[0m"; brew deps $cask | awk '{printf(" %s ", $0)}'; echo ""; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
# codesigning and provisioning profile should be configured using Xcode | |
PROJECT=<your project name> | |
SCHEME=${PROJECT} # Setting project name as the default scheme. Update based on your scheme | |
ARCHIVEPATH=`pwd`/archive | |
IPA_NAME=${PROJECT} | |
PROJECT_BUILDDIR=${ARCHIVEPATH}/${IPA_NAME}.xcarchive/Products/Applications |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import logging | |
import os | |
import socket | |
import ssl | |
import struct | |
import sys | |
import time | |
import uuid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The symptoms. When you do this, you keep on getting new and deleted branches all the time | |
git remote update | |
git pull | |
# Symptom 2 (for obvious reasons). | |
git branch -a --merged # Check the merged branches | |
git push origin --delete [branch name] # this complains remote doesn't exist | |
# The remedy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require('dotenv').config() | |
var kue = require('kue'); | |
console.info('Creating Queue with redis', process.env.REDISCLOUD_URL); | |
var queue = kue.createQueue({ | |
redis: process.env.REDISCLOUD_URL | |
}) | |
console.log('moving forward with kue') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UITextField { | |
func useUnderline() -> Void { | |
let border = CALayer() | |
let borderWidth = CGFloat(2.0) // Border Width | |
border.borderColor = UIColor.red.cgColor | |
border.frame = CGRect(origin: CGPoint(x: 0,y :self.frame.size.height - borderWidth), size: CGSize(width: self.frame.size.width, height: self.frame.size.height)) | |
border.borderWidth = borderWidth | |
self.layer.addSublayer(border) | |
self.layer.masksToBounds = true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension TimeInterval { | |
func stringFormatted() -> String { | |
let interval = Int(self) | |
let seconds = interval % 60 | |
let minutes = (interval / 60) % 60 | |
let hours = (interval / (60*60)) % 60 | |
return String(format: "%02d:%02d:%02d", hours, minutes, seconds) | |
} | |
} |