Skip to content

Instantly share code, notes, and snippets.

View fnc12's full-sized avatar
😈

Yevgeniy Zakharov fnc12

😈
View GitHub Profile
@tomohisa
tomohisa / gist:2897676
Created June 8, 2012 19:20
Add and Remove ChildViewController
// add child view
UIViewController* controller = [self.storyboard instantiateViewControllerWithIdentifier:@"test"];
[self addChildViewController:controller];
controller.view.frame = CGRectMake(0, 44, 320, 320);
[self.view addSubview:controller.view];
[controller didMoveToParentViewController:self];
// remove child view
UIViewController *vc = [self.childViewControllers lastObject];
[vc.view removeFromSuperview];
@jonschlinkert
jonschlinkert / markdown-cheatsheet.md
Last active April 23, 2025 17:58
A better markdown cheatsheet.

Description

When using Homebrew (http://brew.sh) and searching formulas or pull requests you may get the dreaded error message: Github API Rate limit exceeded

Let's fix that! (yeah!)


Short version

Create a new Personal Token in your Github Account Settings (Sidebar: Applications) and then copy the Token. In the Terminal, use export HOMEBREW_GITHUB_API_TOKEN=YOURAPITOKENWITHFUNKYNUMBERSHERE (change that to your API Token) or add that to your .bash_profile and then do source .bash_profile.

@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@jay
jay / PostJSON.c
Last active May 15, 2025 23:22
Use libcurl to POST JSON data.
/* Use libcurl to POST JSON data.
Usage: PostJSON <name> <value>
curl-library mailing list thread:
'how do i post json to a https ?'
https://curl.haxx.se/mail/lib-2015-01/0049.html
* Copyright (C) 2015 Jay Satiro <raysatiro@yahoo.com>
https://curl.haxx.se/docs/copyright.html
@marteinn
marteinn / progamatically-popover-example.m
Last active January 15, 2022 12:13
NSPopover Example: Create and show a NSPopover programmatically when a user clicks a button in a subview
-(void) buttonClick:(NSButton *)sender {
// Create view controller
EXPopoverViewController *viewController = [[EXPopoverViewController alloc] init];
// Create popover
NSPopover *entryPopover = [[NSPopover alloc] init];
[entryPopover setContentSize:NSMakeSize(200.0, 200.0)];
[entryPopover setBehavior:NSPopoverBehaviorTransient];
[entryPopover setAnimates:YES];
[entryPopover setContentViewController:viewController];
@ClaudeSutterlin
ClaudeSutterlin / UIImageFixedOrientationExtension.swift
Last active September 12, 2018 12:52 — forked from schickling/UIImageFixedOrientationExtension.swift
[Swift3] Extension to fix orientation of an UIImage (Sets orientation to portrait)
extension UIImage {
func fixedOrientation() -> UIImage {
if imageOrientation == .up {
return self
}
var transform: CGAffineTransform = CGAffineTransform.identity
extension Sequence {
func countIf( predicate: (Self.Iterator.Element) -> Bool ) -> Int {
return reduce( 0 ) { predicate($1) ? $0+1 : $0 }
}
}
@abhi21git
abhi21git / ExtensionURLRequest.swift
Last active April 8, 2025 10:51
Swift cURL Printer
//
// ExtensionURLRequest.swift
//
// Created by Abhishek Maurya on 16/07/20.
// Copyright © 2020. All rights reserved.
//
import Foundation
extension URLRequest {
@foxicode
foxicode / DatePickerPopup.swift
Created September 13, 2020 06:32
Popup view with UIDatePicker (Swift, iOS)
import UIKit
import SnapKit
class DatePickerPopup: UIView {
private var frameView: UIView!
private var titleLabel: UILabel!
private var datePicker: UIDatePicker!
private var okButton: UIButton!
private var cancelButton: UIButton!