Skip to content

Instantly share code, notes, and snippets.

View ratulSharker's full-sized avatar
:shipit:
Learning

Ratul sharker ratulSharker

:shipit:
Learning
View GitHub Profile
@ratulSharker
ratulSharker / UIImage+base64Encoding.swift
Created April 11, 2018 06:29
Extension for converting an UIImage into Base64 String
import UIKit
extension UIImage {
func base64EncodingString() -> String {
let imageData:Data = UIImagePNGRepresentation(self)!
return imageData.base64EncodedString()
}
}
@ratulSharker
ratulSharker / Prime Factorization.cpp
Last active November 28, 2017 15:28
Finding the prime factorization of an integer
#include <map>
//
// @param number : Of which you want the prime factorization.
// @param freq : Where to store the prime factorization result.
//
void primeFactorization(unsigned long long number, std::map<int, int> &freq)
{
// initially divide via 2
// it has a special thing like
@ratulSharker
ratulSharker / UICollectionView+Highlight.h
Created September 18, 2017 08:42
Highlighting a UICollectionViewCell while it's not been into the view window.
//
// UICollectionView+Highlight.h
//
// Created by Ratul Sharker on 9/18/17.
//
#import <UIKit/UIKit.h>
@interface UICollectionView (Highlight)
@ratulSharker
ratulSharker / NSTimerBlock.h
Last active August 17, 2017 11:59
NSTimer does not support block until the release of ios 10. This gist can serve in that situation.
#import <Foundation/Foundation.h>
//
// HISTORY...
//
// from ios 10 simillar functionality is given which is initialized
// with a block, but we need to support the older version too,
// thats why this class is been introduced
//
@ratulSharker
ratulSharker / UDPEchoClient.h
Last active January 9, 2022 10:33
UDP Echo client using objective-c CFSocket
#import <Foundation/Foundation.h>
@interface UDPEchoClient : NSObject
- (BOOL) sendData:(const char *)msg;
@end