Skip to content

Instantly share code, notes, and snippets.

@Ali72
Ali72 / CoreMediaError.swift
Last active May 14, 2024 15:28
AVPlayer CoreMedia Errors
/**
-NOTE:
After AVPlayerItem faces an error you can create CoreMedia Error from the underlying Error inside AVPlayerItem error.
With the `CoreMediaError` enum, you can convert errors to more readable ones,handle AVPlayerItem Common errors,
and show the proper messages to your users.
**/
public enum CoreMediaError:Error {
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active May 14, 2024 15:28
set -e, -u, -o, -x pipefail explanation
@davidalves1
davidalves1 / desfazendo-push.md
Last active May 14, 2024 15:28
Desfazendo um git push

Desfazendo um git push

Não é possível desfazer um push diretamente, como é feito com o commit utilizando o comando $ git reset --soft|mixed|hard hash-do-penultimo-commit

Para desfazer um push são necessários 3 passos:

  1. Utilizar o comando $ git reset --mixed HEAD~1 e em seguida utilizar o comando $ git stash (se preferir pode usar a opção -m "revertendo o push blablabla" para salvar o stash com um contexto do que foi feito
  2. Utilizar o comando $ git revert HEAD~0
  3. Utilizar o comando $ git stash apply
  4. Utilizar o comando $ git push origin sua-branch -f
@ECHO OFF
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Private goto MDPrivate
:CONFIRM
echo Are you sure to lock this folder? (Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
@helgatheviking
helgatheviking / kia_convert_country_code.php
Created December 7, 2015 19:01
Converts the WooCommerce country codes to 3-letter ISO codes
<?php
/**
* Converts the WooCommerce country codes to 3-letter ISO codes
* https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
* @param string WooCommerce's 2 letter country code
* @return string ISO 3-letter country code
*/
function kia_convert_country_code( $country ) {
$countries = array(
'AF' => 'AFG', //Afghanistan
@mishurov
mishurov / syntax.s
Last active May 14, 2024 15:26
AT&T assembly syntax and IA-32 instructions
# --------
# Hardware
# --------
# Opcode - operational code
# Assebly mnemonic - abbreviation for an operation
# Instruction Code Format (IA-32)
# - Optional instruction prefix
# - Operational code
@MazeW
MazeW / nanodisplaytest.md
Last active May 14, 2024 15:25
Connecting an IPS TFT display (ST7789) to an arduino nano and testing image output.

Guide on connecting a ST7789 display to an Arduino Nano.

I recently decided to order an arduino nano and a tft display from AliExpress. When I looked up online it took me some time to find a clear guide how to connect the display to the arduino, either the display had different pins or it was a slightly different model, but with some trial and error, I managed to get it to work.

What you'll need for this:

  • 1x Arduino Nano
  • 1x AdaFruit 1.3" 240x240 ST7789 display
  • 6x jumper wires or whatever else you can use to connect

Connecting display to the arduino

@SheldonWangRJT
SheldonWangRJT / Convert .mov or .MP4 to .gif.md
Last active May 14, 2024 15:25
Convert Movie(.mov) file to Gif(.gif) file in one command line in Mac Terminal

This notes is written by Sheldon. You can find me with #iOSBySheldon in Github, Youtube, Facebook, etc.

Need

Convert .mov/.MP4 to .gif

Reason

As a developer, I feel better to upload a short video when I create the pull request to show other viewers what I did in this PR. I tried .mov format directly got after finishing recording screen using Quicktime, however, gif offers preview in most web pages, and has smaller file size.

This is not limited to developer, anyone has this need can use this method to convert the files.

@donaldpipowitch
donaldpipowitch / README.md
Last active May 14, 2024 15:25
Use GitLab Pages to deploy a Storybook per branch

It's quite straightforward to use GitLab Pages to deploy a Storybook instance per branch (and remove it whenever the branch will be removed). And yeah, it's irony to document this in a GitHub Gist 😅

You just need a .gitlab-ci.yml like this one:

stages:
  - setup
  - build-and-test
  - deployment
  - pages
@strangerstudios
strangerstudios / my_pmpro_email_recipient.php
Last active May 14, 2024 15:24
The gist below disables the user notification when an admin changes their membership level or expiration date. Change line 6 to disable other or more PMPro emails.
/*
Disable the "Admin Change" emails in Paid Memberships Pro
*/
function my_pmpro_email_recipient($recipient, $email)
{
if($email->template == "admin_change" || $email->template == "admin_change_admin") //could check for a different template here
$recipient = NULL;
return $recipient;
}
add_filter("pmpro_email_recipient", "my_pmpro_email_recipient", 10, 2);