Skip to content

Instantly share code, notes, and snippets.

View w-i-n-s's full-sized avatar
🏠
Working from home

Sergey Vinogradov w-i-n-s

🏠
Working from home
  • Varna, Bulgaria
View GitHub Profile
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
NSString *info = @"http://codeafterhours.wordpress.com";
// Generation of QR code image
NSData *qrCodeData = [info dataUsingEncoding:NSISOLatin1StringEncoding]; // recommended encoding
CIFilter *qrCodeFilter = [CIFilter filterWithName:@"CIQRCodeGenerator"];
[qrCodeFilter setValue:qrCodeData forKey:@"inputMessage"];
@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active May 4, 2024 04:45
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@pietbrauer
pietbrauer / Makefile
Created April 26, 2015 10:03
Shutdown and reset all iOS Simulators
erase_sim:
./reset_sim.sh 2>/dev/null; true
@MihaelIsaev
MihaelIsaev / CameraViewController.swift
Created April 16, 2015 19:30
This is the example of camera view for iOS written in Swift
import UIKit
import AVFoundation
class ViewController: UIViewController, AVCaptureMetadataOutputObjectsDelegate {
@IBOutlet weak var myView: UIView!
var session: AVCaptureSession?
var device: AVCaptureDevice?
var input: AVCaptureDeviceInput?
@geekmanager
geekmanager / make-git-use-sublime.markdown
Last active July 3, 2023 12:22
Making git use Sublime Text for rebase etc

Making git use Sublime Text

First up, let's make Sublime Text 2 available from the command line in terminal, by creating a link to subl which is the launcher from terminal:

ln -s /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime

(added bonus of this approach is when you upgrade to ST3 or change text editor, you can just redirect the symlink).

If there's any chance that bash doesn't check usr/local/bin then use [Launch Sublime Text 2 from Mac OSX Terminal] for more detailed instructions on how to make this happen.

@iamjason
iamjason / UIImage+Tinting.swift
Last active December 10, 2019 21:59
Swift UIImage extension for tinting images
/**
Usage:
let originalImage = UIImage(named: "cat")
let tintedImage = originalImage.tintWithColor(UIColor(red: 0.9, green: 0.7, blue: 0.4, alpha: 1.0))
*/
extension UIImage {
func tintWithColor(color:UIColor)->UIImage {
@phatfly
phatfly / cmakeAndTaglib
Last active April 25, 2024 08:45
compile taglib for iOS
I wanted to document the process that I went through to compile taglib for my iOS project.
At the time of this writing I used TagLib 1.9.1
1. Download taglib at: http://taglib.github.io/
2. Download ios-make at: github.com/plenluno/ios-cmake
3. The ios-make file that you need is in the toolchain directory. Copy the whole directory “toolchain” from inside the ios-make directory to taglib directory.
@adrienjoly
adrienjoly / restartCoreAudio.sh
Created December 25, 2013 01:07
Mac Os X command to restart the core audio. I needed to use this in order to fix my AirPlay issue.
# You have to restart the core audio be pasting the following line into termnal
sudo kill `ps -ax | grep 'coreaudiod' | grep 'sbin' |awk '{print $1}'`
@uknowho
uknowho / UIImage+withColor.m
Created July 3, 2013 04:02
A quick way to create an UIImage of a solid color for a specified dimension. You can use this bit of code in an Objective-C category to "extend" UIImage.
+ (UIImage *)imageWithColor:(UIColor *)color andBounds:(CGRect)imgBounds {
UIGraphicsBeginImageContextWithOptions(imgBounds.size, NO, 0);
[color setFill];
UIRectFill(imgBounds);
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
@itsjustcon
itsjustcon / UIColor+Hex.mm
Created June 10, 2013 19:31
Get UIColor from HEX in Objective-C. Great for programmatically creating color swatches on iOS + OS X!
+ (UIColor *) colorFromHexCode:(NSString *)hexString {
NSString *cleanString = [hexString stringByReplacingOccurrencesOfString:@"#" withString:@""];
if([cleanString length] == 3) {
cleanString = [NSString stringWithFormat:@"%@%@%@%@%@%@",
[cleanString substringWithRange:NSMakeRange(0, 1)],[cleanString substringWithRange:NSMakeRange(0, 1)],
[cleanString substringWithRange:NSMakeRange(1, 1)],[cleanString substringWithRange:NSMakeRange(1, 1)],
[cleanString substringWithRange:NSMakeRange(2, 1)],[cleanString substringWithRange:NSMakeRange(2, 1)]];
}
if([cleanString length] == 6) {
cleanString = [cleanString stringByAppendingString:@"ff"];