Skip to content

Instantly share code, notes, and snippets.

View LC43's full-sized avatar
🏄‍♀️
Digital nomad

Pedro de Carvalho LC43

🏄‍♀️
Digital nomad
View GitHub Profile
<?php
if( $handle ) {
// [...]
do {
$status = curl_multi_exec($mastercurling, $running);
curl_multi_select( $mastercurling );
} while( $running > 0 );
// } while($status == CURLM_CALL_MULTI_PERFORM);
// ^^ this parens should match do { but there's no way to know that.

Keybase proof

I hereby claim:

  • I am lc43 on github.
  • I am pcarvalho (https://keybase.io/pcarvalho) on keybase.
  • I have a public key whose fingerprint is 6FE9 E2FE 5217 A620 193B 77CA 9B59 EE18 36F9 4A40

To claim this, I am signing this object:

.list-card-title span {
display: inline-block;
background-color: rgb(0, 174, 204);
color: rgb(255, 255, 255);
border-radius: 6px;
padding: 5px;
margin-right: 10px;
min-width: 32px;
text-align: center;
}
@LC43
LC43 / .bash_wp
Created September 17, 2017 02:34
Compress directory, excluding dev files
#!/bin/bash
function wp_make_theme() {
local curdate=`date +%Y-%m-%d-%H%M%S`
local exclude='';
local name=${1%/}
if [ -f ./exclude_prod ]; then
exclude="./exclude_prod";
elif [ -f ~/.exclude_prod ]; then
exclude="$HOME/.exclude_prod";
node_modules
*tgz*
*tar*
*zip*
.editorconfig
.jshintrc
CHANGELOG.md
README*
readme*
CONTRIBUTING.md
@LC43
LC43 / raisewindow.sh
Last active November 25, 2017 06:46
Raise window by name
#!/bin/bash
# name of app
if [ -z "$1" ]; then
echo "provide a name for the window to be raised"
exit;
fi
app_name="$1"
# get current desktop:
desktop_id=$(xprop -root | grep "^_NET_CURRENT_DESKTOP" | cut -f 3 -d ' ')
@LC43
LC43 / test-declare.sh
Created November 28, 2017 15:33
compare declare with assign
# use declare
var1="aaa"; var2=var1; declare "$var2=bbb"; echo $var1; echo $var2
# returns:
# bbb
# var1
var1="aaa"; var2=var1; var2=bbb; echo $var1; echo $var2
# returns:
@LC43
LC43 / wget_site.sh
Last active June 20, 2020 16:47
download a site using wget
#!/bin/bash
function wget_site(){
## Remove protocol part of domain to add it to the allow list
# source : https://www.cyberciti.biz/faq/get-extract-domain-name-from-url-in-linux-unix-bash/
local url="$1"
local domain="$1"
domain="${domain#http://}"
domain="${domain#https://}"
domain="${domain#ftp://}"
domain="${domain#scp://}"
01: !0                                // absolute best score  2  : vv
//~02: 0,a                            // absolute best score  3  : vv // old question
02: str_rot13                         // absolute best score  9  : vv
03: !0                                // absolute best score  2  : vv
04: 0                                 // absolute best score  1  : vv
05: 𡃁                                // absolute best score  1  : vv
06: $a=function()use(&$a){return$a;}  // absolute best score 22  : xx 32
07: (object)[1]                       // absolute best score 12  : vv
08:                                   // absolute best score 23  : xx --
@LC43
LC43 / example_poor_docs.php
Last active August 26, 2018 16:22
Example of poor documentation. It documents the part that is easier to read, but fails to explain why only future dates are important.
// if end date is in future
if ( $date_catchup_timestamp_end >= strtotime( 'now' ) ) {
// [...] do a lot of stuff
$program->end = $date_catchup_timestamp_end;
}