Skip to content

Instantly share code, notes, and snippets.

Ajith R N ajithrn

Block or report user

Report or block ajithrn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ajithrn / Making Apple Push Notification certificates on Linux
Last active Jul 26, 2019 — forked from boodle/Making Apple Developer certificates on Linux
Making Apple Apple Push Notification certificates on Linux
View Making Apple Push Notification certificates on Linux
1. Create a new directory;
mkdir Apple\ Enterprise
cd Apple\ Enterprise
2. Generate a certificate signing request
openssl req -nodes -newkey rsa:2048 -keyout aps.key -out CertificateSigningRequest.certSigningRequest
3. With the information like so (ensure you give it a password):
Country Name (2 letter code) [AU]:GB
State or Province Name (full name) [Some-State]:London
ajithrn / .htaccess
Last active Mar 23, 2019
force htps - WP htacceess
View .htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
ajithrn / wp_api_cors_headers.php
Created Mar 15, 2019
CORS for the WordPress REST API
View wp_api_cors_headers.php
* CORS for the WordPress REST API
function kms_wp_rest_api_cors() {
remove_filter('rest_pre_serve_request', 'rest_send_cors_headers');
add_filter('rest_pre_serve_request', function ($value) {
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET');
header('Access-Control-Allow-Credentials: true');
ajithrn / wc-percentage-based-surcharge.php
Created Mar 8, 2019 — forked from woogists/wc-percentage-based-surcharge.php
[Frontend Snippets][Add a surcharge to cart and checkout] Add a percentage based surcharge to all transactions
View wc-percentage-based-surcharge.php
* Add a 1% surcharge to your cart / checkout
* change the $percentage to set the surcharge to a value to suit
add_action( 'woocommerce_cart_calculate_fees','woocommerce_custom_surcharge' );
function woocommerce_custom_surcharge() {
global $woocommerce;
if ( is_admin() && ! defined( 'DOING_AJAX' ) )
ajithrn / css-centre-crop-image.css
Created Sep 21, 2018 — forked from rotassator/css-centre-crop-image.css
CSS: centre and crop an image with a fixed height
View css-centre-crop-image.css
/* Centre and crop an image with a fixed height */
.crop {
position: relative; /* provide a positioning context */
overflow: hidden;
height: 200px; /* make space */
.crop img {
position: absolute;
left: -100%; /* anchor the image corners outside the viewable area (increase for large images) */
right: -100%;
ajithrn / hosts
Last active Jun 20, 2017 — forked from avtaniket/localhost to custom domain in ubuntu.txt
Ubuntu / localhost to custom domain
View hosts
Step 1: Add domain entry in hosts file (sudo nano /etc/hosts)
Step 2: Add redirection policy in IP-Tables
sudo iptables -t nat -A OUTPUT -o lo -p tcp --dport 80 -j REDIRECT --to-port 8888
ajithrn / extras.php
Last active Feb 27, 2017 — forked from yoren/functions.php
WP : next / prev post link
View extras.php
* Return the right previous_post_link / next_post_link when change posts order
* ref:
* more reading :
function kms_previous_post_where() {
global $post, $wpdb;
return $wpdb->prepare( "WHERE p.menu_order < %s AND p.post_type = %s AND p.post_status = 'publish'", $post->menu_order, $post->post_type);
View bootstrap-sass-mixin-cheatsheet.scss
// Alerts
@include alert-variant($background, $border, $text-color);
// Background Variant
@include bg-variant($parent, $color);
// Border Radius
@include border-top-radius($radius);
@include border-right-radius($radius);
@include border-bottom-radius($radius);

Keybase proofI hereby claim: * I am ajithrn on github. * I am ajithrn ( on keybase. * I have a public key whose fingerprint is 5F27 72B1 14D4 A3DF B546 B887 3885 85FE A8FE A168To claim this, I am signing this object:```json{ "body": { "key": { "eldest_kid": "010156aa08d1a6a35f6d82389a82f243d748c65b5c6df93bf68f1fc2678969b6f6800a", "fingerprint": "5f2772b114d4a3dfb546b887388585fea8fea168", "host": "", "key_id": "388585fea8fea168", "kid": "010156aa08d1a6a35f6d82389a82f243d748c65b5c6df93bf68f1fc2678969b6f6800a", "uid": "d7159c83cb4a68e2224f3e7d64296019", "username": "ajithrn" }, "service": { "name": "github", "username": "ajithrn" }, "type": "web_service_binding", "version": 1 }, "ctime": 1480881277, "expire_in": 157680000, "prev": "3e06523e876e9b04cc93054c457a9d8eaec95faef638dc72f7b491416fa25054", "seqno": 7,

ajithrn / export.sql
Created Dec 2, 2016 — forked from jonahcoyote/export.sql
Sabai Directory Export SQL
View export.sql
Here are some export examples you can use to export Sabai directory data. I'm no MySQL expert and there's probably better ways to run these queries but this worked for my purposes. I hope this helps!
Note, this is going to export all columns and you'll need to manually go in and remove columns you don't need in Excel or Numbers or whatever spreadsheet program you have.
This is meant to be run in phpMyAdmin. Look at your own table structure and modify as necessary for any custom fields, table prefix, and custom bundle. Custom fields are storedin their own tables and cross linked via entity_id which is the id of a listing.
You can’t perform that action at this time.