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
[
{
"name": "Afghanistan",
"code": "AF"
},
{
"name": "Åland Islands",
"code": "AX"
},
{
<?php
/**
* Usage:
* $message = 'My First Push Notification!';
* $pushServer = new PushSerer();
* $pushServer->pushToGoogle('REG-ID-HERE', $message);
* $pushServer->pushToApple('DEVICE-TOKEN-HERE', $message);
*/
class PushServer
<?php
/**
* Usage:
* $message = 'My First Push Notification!';
* $pushServer = new PushSerer();
* $pushServer->pushToGoogle('REG-ID-HERE', $message);
* $pushServer->pushToApple('DEVICE-TOKEN-HERE', $message);
*/
class PushServer
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 / edd-sort-archive-by-sales.php
Created November 8, 2016 09:58 — forked from mindctrl/edd-sort-archive-by-sales.php
Sort the downloads archive in Easy Digital Downloads by number of sales
<?php
/*
Plugin Name: Easy Digital Downloads - Sort archive by number of sales
*/
function jp_sort_downloads_archive( $query ) {
if ( is_post_type_archive( 'download' ) && $query->is_main_query() ) {
$query->set( 'meta_key', '_edd_download_sales' );
$query->set( 'orderby', 'meta_value_num' );
$query->set( 'order', 'DESC' );
}
@rahilwazir
rahilwazir / post-merge
Created November 18, 2016 08:31 — forked from sindresorhus/post-merge
git hook to run a command after `git pull` if a specified file was changed.In this example it's used to run `npm install` if package.json changed and `bower install` if `bower.json` changed.Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
#!/usr/bin/env bash
# MIT © Sindre Sorhus - sindresorhus.com
# git hook to run a command after `git pull` if a specified file was changed
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`.
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
check_run() {
echo "$changed_files" | grep --quiet "$1" && eval "$2"
@rahilwazir
rahilwazir / mkgit-centos6.sh
Last active March 15, 2017 13:33 — forked from eyecatchup/mkgit-centos6.sh
Bash script to install the latest Git version on CentOS 6.x.
#!/usr/bin/env bash
# Install the latest version of git on CentOS 6.x
# Install Required Packages
sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
sudo yum install gcc perl-ExtUtils-MakeMaker
# Uninstall old Git RPM
sudo yum remove git