Skip to content

Instantly share code, notes, and snippets.

@tommai78101
tommai78101 / unicode.c
Last active May 5, 2024 10:47
UTF-8 to UTF-16 one-way conversion, written in C
#include <stdio.h>
#include <stdlib.h>
#include <uchar.h>
#include <locale.h>
#define __STD_UTF_16__
//Pointer arrays must always include the array size, because pointers do not know about the size of the supposed array size.
void utf8_to_utf16(unsigned char* const utf8_str, int utf8_str_size, char16_t* utf16_str_output, int utf16_str_output_size) {
//First, grab the first byte of the UTF-8 string
@devzakir
devzakir / app.js
Created March 24, 2021 15:34
vuejs navigation guard
// check authentication
let auth = localStorage.getItem("auth");
if(auth){
store.dispatch('authUser').then(() => {
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
@adeleinr
adeleinr / Python Cheatsheet
Last active May 5, 2024 10:39
Python Cheetcheat
SORTING
=======
Returns a sorted list => sorted(l)
Sort in place ==> l.sort([2,3,7])
# Reverse sorting by y in an (x,y) tuple list in
sorted([(1,2),(2,3)], key=lambda tup: tup[0],reverse=True))
sample = [('Jack', 76), ('Beneth', 78), ('Cirus', 77), ('Faiz', 79)]
sample.sort(key=lambda a: a[1])
@devzakir
devzakir / auth.js
Created March 24, 2021 15:37
Vuex Store Action Example
import axios from 'axios'
import router from '../router'
export default {
namespaced: true,
state: {
authenticated: false,
user: null
},
@PurpleVibe32
PurpleVibe32 / vmwk17key.txt
Last active May 5, 2024 10:36
Free VMware Workstation Pro 17 full license keys
Install VMWare Workstation PRO 17 (Read it right. PRO!)
Also, these keys might also work with VMWare Fusion 13 PRO. Just tested it.
Sub to me on youtube pls - PurpleVibe32
if you want more keys - call my bot on telegram. @purector_bot (THE BOT WONT REPLY ANYMORE) - Or: https://cdn.discordapp.com/attachments/1040615179894935645/1074016373228978277/keys.zip - the password in the zip is 102me.
---
This gist can get off at any time.
PLEASE, DONT COPY THIS. IF YOU FORK IT, DONT EDIT IT.
*If you have a problem comment and people will try to help you!
*No virus
@wojteklu
wojteklu / clean_code.md
Last active May 5, 2024 10:35
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 5, 2024 10:30
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@jesserundle
jesserundle / gist:4693541
Last active May 5, 2024 10:28
Installing Ruby, Rails, and mysql gem on Windows
Install Ruby using rubyinstaller:
http://rubyinstaller.org/downloads/
install to the C drive to a folder without spaces, eg c:/Ruby193
Install RubyGems:
http://rubyforge.org/frs/?group_id=126
on command line do:
'gem install rails'
@krisleech
krisleech / renew-gpgkey.md
Last active May 5, 2024 10:26
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date:

@inidamleader
inidamleader / AutoSizeText.kt
Last active May 5, 2024 10:26
Composable function that automatically adjusts the text size to fit within given constraints with optimal performance by using a binary search algorithm
// LAST UPDATE: 10 April 2024 v4.3:
// - Correction of updated density value in AutoSizeText function
package com.inidamleader.ovtracker.util.compose
import android.util.Log
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.BoxWithConstraintsScope
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.text.InlineTextContent
import androidx.compose.foundation.text.InternalFoundationTextApi