Skip to content

Instantly share code, notes, and snippets.

View wcoder's full-sized avatar
🎯
Focusing

Yauheni Pakala wcoder

🎯
Focusing
View GitHub Profile
@wcoder
wcoder / xamarin_ios_launch_terminal.md
Created October 17, 2019 11:41
Snippets for launch ios app on device/simulator via terminal.

From VS4Mac & Rider:

/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch \
--sdkroot /Applications/Xcode.app/Contents/Developer \
--devname "<DEVICE_NAME>" \
--killdev <APP_BUNDLE_NAME> \
--launchdev <PROJECT_PATH>/bin/iPhone/Debug/<PROJECT_NAME>.app \
--wait-for-unlock \
--argument=-connection-mode\
--argument=usb -sdk 10.0 \
DEVICE_NAME="iPhone 11"
APP_BUNDLE_ID="com.softeq.Playground-iOS"
# Device ID
DEVICE_UDID=$(xcrun simctl list devices iphone available | grep "${DEVICE_NAME} (" | sed -e 's/^.*(\(.*\)) (.*$/\1/')
echo "DEVICE_ID=${DEVICE_UDID}"
# Boot device
xcrun simctl boot $DEVICE_UDID
@wcoder
wcoder / jquery-1.10.2.min.js
Created October 22, 2019 22:18
404 Page Galaxy Sample
/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery-1.10.2.min.map
*/
(function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.2",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("o
@wcoder
wcoder / ssl-pinning.cs
Last active December 12, 2019 12:47
Sample of SSL-pinning via NSUrlSession for Xamarin.iOS.
internal static class Samples
{
public static void MakeRequest()
{
var s = "https://secure-domain.org";
var request = new NSMutableUrlRequest(new NSUrl(s))
{
HttpMethod = "GET"
};
@wcoder
wcoder / ManagedReference.extension.js
Created February 28, 2020 08:25
DocFX custom template for aggregate namespaces by assembly/components.
exports.preTransform = function (model) {
transformItem(model, 1);
return model;
function transformItem(item, level) {
var log = "====================================================\n";
var isAssembly = item.parent == null && item.assemblies.indexOf(item.uid) !== -1;
public static void RemoveFacebookCookies()
{
var websiteDataTypes = WKWebsiteDataStore.AllWebsiteDataTypes;
WKWebsiteDataStore.DefaultDataStore.FetchDataRecordsOfTypes(websiteDataTypes, (NSArray records) =>
{
for (nuint i = 0; i < records.Count; i++)
{
var record = records.GetItem<WKWebsiteDataRecord>(i);
if (record.DisplayName.Contains("facebook"))
{
@wcoder
wcoder / stations.json
Last active February 17, 2021 10:52
Railway stations. For app development only
[
{
"id": "1",
"ru": "443 км",
"be": "443 км",
"be_lat1": "443 km",
"be_lat2": "443 km"
},
{
"id": "2",
@wcoder
wcoder / firestore-document-id.js
Created February 23, 2021 12:00
Snippet to simply generate Firestore Document ID outside of Firebase SDK. (Javascript, Node.js)
const { randomBytes } = require('crypto');
// Sources: https://github.com/firebase/firebase-js-sdk/blob/4090271bb71023c3e6587d8bd8315ebf99b3ccd7/packages/firestore/src/util/misc.ts#L27-L55
const newId = () => {
// Alphanumeric characters
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
// The largest byte value that is a multiple of `char.length`.
const maxMultiple = Math.floor(256 / chars.length) * chars.length;
let autoId = '';
@wcoder
wcoder / replace-projectreference-csproj.md
Created June 9, 2021 21:43
Replace .csproj old project reference format to new one.
  1. open text editor (with ability to replace text via regex)
  2. open target .csproj file
  3. start find and replace: (csproj")>\n(.*)Project>\n(.*)Name>\n(.*)ProjectReference>
  4. to $1 /&gt;