Skip to content

Instantly share code, notes, and snippets.

View saamerm's full-sized avatar
💭
Answering Questions, & Questioning Answers

Saamer Mansoor saamerm

💭
Answering Questions, & Questioning Answers
View GitHub Profile
@saamerm
saamerm / ListId.json
Last active October 15, 2019 18:45
JSON List of 2 GUIDs that are identical
[
{
"title": "Here's a sample title",
"id": "4d79041e-f25f-421d-9e5f-3462459b9934",
"thumbnail": "https://via.placeholder.com/150/12c952"
},
{
"title": "Here's another sample title",
"id": "4d79041e-f25f-421d-9e5f-3462459b9934",
"thumbnail": "https://via.placeholder.com/150/E2c952"
@saamerm
saamerm / BinarySearchTree.cs
Last active December 30, 2019 00:57
Comprehensive Implementation of a Binary Search Tree in C#, with explanations
using System;
namespace BinarySearchTree
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("\n\nCreate the BST! \n");
var array = new int?[]{ 10, 5, 18, 5, 13, 20, null, 3, 5};
@saamerm
saamerm / resizer.py
Last active April 22, 2020 00:08
Image Resizer for Android & iOS App Icons
#This image resizer takes your image from the Python2 folder and resizes it based on code in the im.resize function
# You will have to install PIL using sudo pip3 install python-resize-image
from PIL import Image
import os, sys
# The path will need to be played around with, this code worked with my Mac
path = "/Users/saamer/Documents/Python2/"
dirs = os.listdir( path )
@saamerm
saamerm / Version.json
Created June 3, 2019 22:42
Simple Json file to create a check to download a new version of the app
{"latestVersion":"2"}
{"v":"5.0.0","fr":25,"ip":0,"op":98,"w":1080,"h":1080,"nm":"estimate","ddd":0,"assets":[{"id":"comp_12","layers":[{"ddd":0,"ind":1,"ty":0,"nm":"circles trimmed","refId":"comp_13","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[540,540,0],"ix":2},"a":{"a":0,"k":[540,540,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":1080,"h":1080,"ip":49,"op":50,"st":49,"bm":0},{"ddd":0,"ind":2,"ty":0,"nm":"circles trimmed","refId":"comp_13","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[540,540,0],"ix":2},"a":{"a":0,"k":[540,540,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":1080,"h":1080,"ip":0,"op":50,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":0,"nm":"circles trimmed","refId":"comp_13","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[540,540,0],"ix":2},"a":{"a":0,"k":[540,540,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":1080,"h":1080,"ip":0,"op":50,"st":-49,"bm":0}]},{"id":"comp_13","la
<!--
Copyright (c) 2019 by Saamer Mansoor (https://codepen.io/saamerm/pen/OYmNqo)
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 limitation the 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 OR OTHERWISE, ARISING FROM, OUT O
@saamerm
saamerm / Parsing String- "0" Responses
Last active April 15, 2019 17:52
This gist helps in parsing String- "0" Responses that comes back from services in C3. Some annoying developers do not return REST services but instead return the response in a weird format of "0" which is an integer inside a string.
public static void Main(string[] args)
{
var token = "{TOKEN GOES HERE}";
// Method 1 of getting the string from the services
HttpClient client = new HttpClient();
var uri = "https://q1.asdfsafasfa.com/IsMarriedAndConsent";
var value = new AuthenticationHeaderValue(token);
client.DefaultRequestHeaders.Authorization = value;
string obstring = client.GetStringAsync(uri).Result;
@saamerm
saamerm / ThumbsUpLottieAnimation.json
Created March 26, 2019 04:27
Thumbs up animation from Lottie Files
{"v":"5.4.3","fr":60,"ip":0,"op":600,"w":128,"h":128,"nm":"preview","ddd":0,"assets":[{"id":"comp_0","layers":[{"ddd":0,"ind":1,"ty":0,"nm":"(SOURCE)interaction_like_03","refId":"comp_1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":0,"s":[44,260.6,0],"e":[55,216.048,0],"to":[6.5,-19.2178478240967,0],"ti":[-0.65388894081116,20.4068565368652,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":100,"s":[55,216.048,0],"e":[39.5,128.052,0],"to":[0.90481543540955,-28.2378826141357,0],"ti":[-0.93672525882721,31.4913558959961,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":152,"s":[39.5,128.052,0],"e":[47.5,73.989,0],"to":[0.7956475019455,-26.7485237121582,0],"ti":[3.53225326538086,24.3391342163086,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"n":"0p833_0p833_0p167_0p167","t":200,"s":[47.5,73.989,0],"e"
@saamerm
saamerm / successAnimation.json
Created March 26, 2019 02:00
Json file for the success sign
{"v":"5.1.16","fr":24,"ip":0,"op":96,"w":300,"h":300,"nm":"tick","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"char Outlines","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":66,"s":[0],"e":[100]},{"t":72}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[150.033,158.225,0],"ix":2},"a":{"a":0,"k":[103.372,183.677,0],"ix":1},"s":{"a":0,"k":[45.748,45.748,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[13.337,14.078],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"st","c":{"a":0,"k":[0.78017799527,0.78017799527,0.78017799527,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":0,"ix":5},"lc":1,"lj":1,"ml":4,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"fl","c":{"a":0,"k":[0.969000004787,0.388000009574,0.423999980852,1],"ix":4},"o":{"a":0,"k":20,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic -
@saamerm
saamerm / HelperImageExtension.cs
Last active February 23, 2019 00:10
Trial at Converting UIBarButtonSystemItem to UIImage in Xamarin.iOS C#
// Solution provided by @dalexsoto from https://gitter.im/xamarin/xamarin-macios
[DllImport (Constants.ObjectiveCLibrary, EntryPoint = "objc_msgSend")]
public extern static IntPtr IntPtr_objc_msgSend (IntPtr receiver, IntPtr selector);
public static UIImage GetImage (UIBarButtonSystemItem systemItem)
{
var tempItem = new UIBarButtonItem (systemItem);
// Add to toolbar and render it
var bar = new UIToolbar ();