Skip to content

Instantly share code, notes, and snippets.

View statickidz's full-sized avatar
💯
Focusing

Adrián Barrio Andrés statickidz

💯
Focusing
View GitHub Profile
@statickidz
statickidz / Gruntfile.js
Created February 6, 2016 11:55
Copy new file updates to directory with Grunt
var date = new Date();
module.exports = function(grunt) {
grunt.initConfig({
watch: {
models: {
files: ['application/models/**/*.php'],
tasks: ['copyTask'],
options: {
spawn: false,
},
@statickidz
statickidz / sublime-remove-blank-lines
Last active March 31, 2016 10:40
Sublime Text - Remove any extra/blank lines
Find > Replace (Select regular expression check)
Find What: \s]*$(?!\w\W])
Replace With:
@statickidz
statickidz / nearby-coordinates.sql
Last active January 31, 2024 20:31
Ordering with SQL by nearest latitude & longitude coordinates (MySQL & SQLite)
---
METHOD 1
This should roughly sort the items on distance in MySQL, and should work in SQLite.
If you need to sort them preciser, you could try using the Pythagorean theorem (a^2 + b^2 = c^2) to get the exact distance.
---
SELECT *
FROM table
ORDER BY ((lat-$user_lat)*(lat-$user_lat)) + ((lng - $user_lng)*(lng - $user_lng)) ASC
@statickidz
statickidz / genymotionwithplay.txt
Created April 8, 2016 11:06 — forked from wbroek/genymotionwithplay.txt
Genymotion with Google Play Services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip)
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip)
1 - Go to https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewiso
2 - Open Chrome console (F12)
3 - Paste this
var _0x5c09=["product-edition","getElementById","innerHTML","<option value='' selected='selected'>Select edition</option><option value='2'>Windows 7 Home Basic SP1 </option><option value='4'>Windows 7 Professional SP1 </option><option value='6'>Windows 7 Home Premium SP1 </option><option value='8'>Windows 7 Ultimate SP1 </option><option value='10'>Windows 7 Home Premium N SP1 </option><option value='12'>Windows 7 Professional N SP1 </option><option value='14'>Windows 7 Ultimate N SP1 </option><option value='16'>Windows 7 Professional K SP1 </option><option value='18'>Windows 7 Professional KN SP1 </option><option value='20'>Windows 7 Home Premium K SP1 </option><option value='22'>Windows 7 Home Premium KN SP1 </option><option value='24'>Windows 7 Ultimate KN SP1 </option><option value='26'>Windows 7 Ultimate K SP1 </option><option value='28'>Windows 7 Starter SP1 </option><opti
@statickidz
statickidz / wordpress_database_dump.php
Created September 22, 2016 11:40
Dump Wordpress database from PHP
<?php
$wpConfig = $_SERVER['DOCUMENT_ROOT'].'/wp-config.php';
if (file_exists($wpConfig)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($wpConfig));
header('Expires: 0');
header('Cache-Control: must-revalidate');
@statickidz
statickidz / search_replace.php
Last active May 19, 2022 10:32
Search and replace files recursive PHP script
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="robots" content="noindex, nofollow"/>
<title>Search and replace files</title>
</head>
<body style="margin: 0; padding: 0;">
<?php
$err_arr = array(0 => '', 1 => '');
@statickidz
statickidz / hex_rgba_alpha.txt
Last active October 10, 2018 15:09
Hexadecimal and RGBA alpha values
Opacity % 255 Step 2 digit HEX prefix
0% 0.00 00
5% 12.75 0C
10% 25.50 19
15% 38.25 26
20% 51.00 33
25% 63.75 3F
30% 76.50 4C
35% 89.25 59
40% 102.00 66
@statickidz
statickidz / .bash_profile
Last active October 6, 2019 10:04
ANDROID_HOME and JAVA_HOME environment variable for Mac OSX
export JAVA_HOME=$(/usr/libexec/java_home)
export ANDROID_HOME=/Users/$USER/Library/Android/sdk
export ANDROID_SDK_ROOT=/Users/$USER/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
export PATH="$HOME/.fastlane/bin:$PATH"
source ~/.nvm/nvm.sh
@statickidz
statickidz / cronjob-certbot.config
Created July 14, 2019 22:32
Elastic Beanstalk single instance HTTPS with Let's Encrypt
files:
"/etc/cron.d/certbot":
mode: "000644"
owner: root
group: root
content: |
56 1 * * * root /opt/certbot/certbot-auto renew
commands:
remove_old_cron:
command: "rm -f /etc/cron.d/*.bak"