Skip to content

Instantly share code, notes, and snippets.

@bohdaq
bohdaq / generic.rs
Last active March 18, 2023 12:28
Using generics in Rust, implementation example and explanation
// real world example from json module of rust-web-server: https://github.com/bohdaq/rust-web-server/tree/main/src/json
// defining generics, library code
pub struct JSONArrayOfObjects<T> {
_item: T, // added to eliminate compiler error
}
pub trait New {
fn new() -> Self;
@bohdaq
bohdaq / # rts - 2022-12-28_20-19-02.txt
Created December 28, 2022 18:29
rts (bohdaq/rust-tls-server/rts) on macOS 13 - Homebrew build logs
Homebrew build logs for bohdaq/rust-tls-server/rts on macOS 13
Build date: 2022-12-28 20:19:02
@bohdaq
bohdaq / gist:9bc4ec9c732806dadf13eb162b9db9cd
Created March 15, 2020 23:00
Create new file using Github API in Go language
package main
import (
"bytes"
"encoding/base64"
"encoding/json"
"fmt"
"io"
"log"
"net/http"
@bohdaq
bohdaq / urlBase64ToUint8Array.js
Created May 13, 2017 07:38 — forked from malko/urlBase64ToUint8Array.js
used in pushManager.Subscribe to correctly encode the key to a Uint8Array
function urlBase64ToUint8Array(base64String) {
const padding = '='.repeat((4 - base64String.length % 4) % 4);
const base64 = (base64String + padding)
.replace(/\-/g, '+')
.replace(/_/g, '/')
;
const rawData = window.atob(base64);
return Uint8Array.from([...rawData].map((char) => char.charCodeAt(0)));
}
@bohdaq
bohdaq / automation.sh
Last active January 16, 2016 22:34
Build xCode iOS Application via command line/terminal and upload it to iTunes Connect (App Store review)
#!/bin/bash
# Make sure you have installed https://github.com/fastlane/deliver#installation and finished Installation and Quick Start sections
# To use this script, simply put it in app directory and execute:
# ./automation.sh YOUR_PROJECT_NAME YOUR_EXPORT_PROVISIONING_PROFILE
rm -f $1.ipa
xcodebuild archive -workspace $1.xcworkspace -scheme $1 -archivePath $1.xcarchive
xcodebuild -exportArchive -archivePath $1.xcarchive -exportPath $1 -exportFormat ipa -exportProvisioningProfile "$2"