Skip to content

Instantly share code, notes, and snippets.

View bibhas's full-sized avatar

Bibhas Acharya bibhas

  • Kathmandu, Nepal
View GitHub Profile
let startLocations: [NSNumber] = [ 0.0, 0.05, 0.25, 0.3]
let endLocations: [NSNumber] = [ 0.7, 0.75, 0.95, 1]
gradient.startPoint = CGPoint(x: -0, y: 0.5)
gradient.endPoint = CGPoint(x: 1, y: 0.5)
gradient.colors = [ UIColor.white.cgColor, UIColor.tetraDarkBlue.cgColor, UIColor.tetraDarkBlue.cgColor, UIColor.white.cgColor ]
gradient.locations = startLocations
layer.insertSublayer(gradient, at: 0)
#import <Foundation/Foundation.h>
static const uint8_t huffman_table[] =
{
0xFF, 0xC4, 0x01, 0xA2, 0x00, 0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02,
0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x01, 0x00, 0x03,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09,
0x0A, 0x0B, 0x10, 0x00, 0x02, 0x01, 0x03, 0x03, 0x02, 0x04, 0x03, 0x05,
@bibhas
bibhas / gist:3f8d7f98c6f9b402e3f2bbe515d7d1bd
Created June 29, 2020 09:03 — forked from paulmelnikow/gist:4645764
Working Objective-C keychain library
NSString *const kKeychainErrorDomain = @"kKeychainErrorDomain"
NSString * ServiceName = @"My Service";
+ (NSError *) errorWithStatus:(OSStatus) status {
if (errSecSuccess == status) return nil;
#if __has_feature(objc_arc)
NSString *message = (__bridge_transfer NSString *)SecCopyErrorMessageString(status, NULL);
#else
NSString *message = [(id) SecCopyErrorMessageString(status, NULL) autorelease];
//
// SUGlobalUpdateLock.h
// Sparkle
//
// Created by Bibhas Acharya on 7/12/20.
// Copyright © 2020 Sparkle Project. All rights reserved.
//
#ifndef SUGLOBALUPDATELOCK_H
#define SUGLOBALUPDATELOCK_H
//
// SUGlobalUpdateLock.h
// Sparkle
//
// Created by Bibhas Acharya on 7/12/20.
// Copyright © 2020 Sparkle Project. All rights reserved.
//
#ifndef SUGLOBALUPDATELOCK_H
#define SUGLOBALUPDATELOCK_H
<!-- Taken from Stripe's docs (https://stripe.com/docs/payments/accept-a-payment?integration=elements) -->
<html>
<head>
<title>Buy cool new product</title>
<script src="https://js.stripe.com/v3/"></script>
<style>
button {
display: block;
margin-bottom: 10px;
margin-left: 5px;
@bibhas
bibhas / checkout.html
Created October 11, 2020 06:18
Stripe support request code
<!-- Taken from Stripe's docs (https://stripe.com/docs/payments/accept-a-payment?integration=elements) -->
<html>
<head>
<title>Buy cool new product</title>
<script src="https://js.stripe.com/v3/"></script>
<style>
button {
display: block;
margin-bottom: 10px;
margin-left: 5px;
//
// Foundation+CoreCode.h
// CoreLib
//
// Created by CoreCode on 15.03.12.
/* Copyright © 2020 CoreCode Limited
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitationthe rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
//
// JMVisibilityManager.m
// CoreLib
//
// Created by CoreCode on So Jan 20 2013.
/* Copyright © 2020 CoreCode Limited
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitationthe rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT
//
// JMVisibilityManager.m
// CoreLib
//
// Created by CoreCode on So Jan 20 2013.
/* Copyright © 2020 CoreCode Limited
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitationthe rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT