Skip to content

Instantly share code, notes, and snippets.

View rahilwazir's full-sized avatar
🎯
Focusing (kinda)

Rahil Wazir rahilwazir

🎯
Focusing (kinda)
View GitHub Profile
npm run configuration
  • JavaScript file: /usr/local/lib/node_modules/npm/bin/npm-cli.js
  • Application parameters: run start
grunt run/debug configuration
  • JavaScript file: /usr/local/lib/node_modules/grunt-cli/bin/grunt
Issue Tracker
git rebase --interactive HEAD~2
# we are going to squash c into b
pick b76d157 b
pick a931ac7 c
# squash c into b
pick b76d157 b
s a931ac7 c
@rahilwazir
rahilwazir / authentication_with_bcrypt_in_rails_4.md
Last active August 29, 2015 14:27 — forked from thebucknerlife/authentication_with_bcrypt_in_rails_4.md
Simple Authentication in Rail 4 Using Bcrypt

#Simple Authentication with Bcrypt

This tutorial is for adding authentication to a vanilla Ruby on Rails app using Bcrypt and has_secure_password.

The steps below are based on Ryan Bates's approach from Railscast #250 Authentication from Scratch (revised).

You can see the final source code here: repo. I began with a stock rails app using rails new gif_vault

##Steps

@rahilwazir
rahilwazir / gist:73e3827e777bfa5b58db
Last active September 15, 2015 13:18 — forked from prime31/gist:5675017
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
@rahilwazir
rahilwazir / access_parent_private_member.php
Last active March 21, 2018 06:24
Access parent class private member from child class
<?php
/**
* Access parent class private member from child class
* @param $class $this|object
* @param $property string
* @param $cache bool
* @return mixed
*/
$cacheStorage = [];
@rahilwazir
rahilwazir / php7-fpm_xdebug_nginx.md
Last active September 22, 2021 19:32
Quick guide to setup Nginx with PHP7-FPM and XDebug

PHP7

  • Ubuntu 16.04+
$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt update
$ sudo apt install nginx php7.1-fpm php7.1-cli php7.1-common php7.1-json php7.1-opcache php7.1-mysql php7.1-phpdbg php7.1-mbstring php7.1-gd php7.1-imap php7.1-ldap php7.1-pgsql php7.1-pspell php7.1-recode php7.1-soap php7.1-tidy php7.1-dev php7.1-intl php7.1-curl php7.1-zip php7.1-xml php-xdebug
@rahilwazir
rahilwazir / correct_permissions_php_project.md
Last active April 4, 2016 14:01
Apply permission for php projects

Do this once

sudo chown www-data:www-data -R <projectpath>
sudo find <projectpath> -type d -exec chmod 755 {} \;
sudo find <projectpath> -type f -exec chmod 644 {} \;
sudo adduser <username> www-data
sudo chmod -R g+rwX <projectpath>
sudo chgrp -R www-data <projectpath>
@rahilwazir
rahilwazir / README.md
Created March 21, 2016 13:18
PHPStorm (IntelliJ) and Xmonad | Grey box issue

Another quick one as I'm sure I'll need to do this on another machine.

When launching PHPStorm, I was presented with a grey box that did nothing. I realised that it was probably related to the fact that I’m running XMonad.

After a quick Google, I came across the the tried and tested setWMName LG3D that I've used previously (to make Source games run under Steam). Unfortunately, this wasn’t working for PHPStorm because I’m also using XMonad.Hooks.EwmhDesktops which nullifies the effect of setWMName.

This issue existing because Xmonad is a non-reparenting window manager, and we need to inform Java of that.

You can either specify the environment variable when launching phpstorm:

@rahilwazir
rahilwazir / yoast-analyzer-subtitle.js
Last active May 2, 2016 08:59
Yoast Subtitle Analyzer
/**
* Source: https://wordpress.org/plugins/meta-box-yoast-seo
*/
/* global jQuery, DS1_fields */
// My custom metabox subtitle input id
var DS1_fields = ['acf-field_54da15f9ad3c2'];
(function (fields) {
@rahilwazir
rahilwazir / README.md
Created April 27, 2016 15:01
MySQL drop all tables from the database

drop_tables.sh

Drop all tables from database

Usage

$ ./drop_tables.sh <db-user> <db-pass> <db-name> <db-host>