Skip to content

Instantly share code, notes, and snippets.

View bitclaw's full-sized avatar

Bitclaw bitclaw

View GitHub Profile
@bitclaw
bitclaw / git-tag-delete-local-and-remote.sh
Created November 7, 2019 19:19 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@bitclaw
bitclaw / android-ubuntu
Created March 9, 2019 16:25 — forked from mpaepper/android-ubuntu
How to debug your Android device under Ubuntu
When programming apps for Android, you usually want to test them on real Android devices.
This little gist describes how to do so using Ubuntu 14.
First, you need to download and install the Android development IDE (http://developer.android.com/sdk/index.html) and create an Android project which you want to debug.
Next, you need to setup the debugging mode on your Android device. Starting in Android 4.2 you need to enable the developer options first: 1) Go to settings 2) Go to About Phone 3) Tap the build number 10 times (or more, not sure ;)) and you will get the notification that you enabled it.
Then go to the developer settings and enable the debug mode for your phone.
Now you think you can just plug it into your USB mode? - Nope.
@bitclaw
bitclaw / add_cloudflare_ips.sh
Created January 9, 2019 14:25 — forked from dduvnjak/add_cloudflare_ips.sh
Add CloudFlare IP addresses to an EC2 Security Group using awscli
# first we download the list of IP ranges from CloudFlare
wget https://www.cloudflare.com/ips-v4
# iterate over the lines in the downloaded file
# make sure to set `--group-id` and `--port`; more details at http://docs.aws.amazon.com/cli/latest/reference/ec2/authorize-security-group-ingress.html
while read p; do aws ec2 authorize-security-group-ingress --group-id sg-e0000000 --protocol tcp --port 80 --cidr $p; done< ips-v4
@bitclaw
bitclaw / usefull_commands.sh
Created February 24, 2018 14:27 — forked from carbontwelve/usefull_commands.sh
Running xdebug in the console, for debugging Laravel artisan commands. Useful as I keep forgetting this one...
# Running xdebug in the console, for debugging Laravel artisan commands. Useful as I keep forgetting this one...
php -dxdebug.remote_autostart artisan
#Running phpcs for 5.3:
phpcs -pv --standards= --runtime-set testVersion 5.3 --ignore=*/public/*,*.js,*.css,*/tests/*,*/views/training/* .
@bitclaw
bitclaw / introrx.md
Created February 17, 2018 04:14 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@bitclaw
bitclaw / laravel.js
Created February 15, 2018 03:40 — forked from JeffreyWay/laravel.js
Want to send a DELETE request when outside of a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. (Requires jQuery, but doesn't have to.) To use, import script, and create a link with the `data-method="DELETE"` attribute.
/*
<a href="posts/2" data-method="delete"> <---- We want to send an HTTP DELETE request
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-confirm="Are you sure?">
*/
(function() {
@bitclaw
bitclaw / cacheController.php
Created February 5, 2018 10:09
Fast idea for cache pagination with Laravel 5.1
/**
* Cache delete handler for Laravel 5.1 pagination.
*
* @array list of laravel cache keys
* @param int $totalResults Total results for pagination
* @param int $perPage Page results
* @return Response
*
* You need to cache your pages with this key pattern:
* Cache::rememberForever('key.' . $currentPage , function(){});
@bitclaw
bitclaw / cache.md
Created February 5, 2018 10:09 — forked from carltondickson/cache.md
Laravel 5.2 cache notes

Cache file name

  • Just an md5 of the cache key
  • Therefore not possible to identify key name from file name - md5 is one way

Cache directory name

  • Level 1 - First 2 characters of filename
  • Level 2 - Next 2 characters of filename
@bitclaw
bitclaw / helpers.php
Created February 5, 2018 10:09 — forked from fer-ri/helpers.php
Delete Laravel Cache By Pattern
<?php
foreach (Cache::getMemory() as $cacheKey => $cacheValue)
{
if (strpos($cacheKey, 'mypackage') !== false)
{
Cache::forget($cacheKey);
}
}