Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
int main(void) {
int m = 11, n = 22;
int *p = &m, *q = &n; //11, 22
printf("%d %d\n", *p, *q);
int **pp = &p, **qq = &q; //11, 22
printf("%d %d\n", **pp, **qq); //
@abhishekbhardwaj
abhishekbhardwaj / php71.sh
Created January 15, 2017 03:00
Install PHP7.1 on OSX with Homebrew
brew update
brew upgrade
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew install php71
## To use PHP7.1 on CLI, add this to .bash_profile
@abhishekbhardwaj
abhishekbhardwaj / .eslintrc
Created September 21, 2018 06:12
Setup ESLint + Prettier in CRA Apps
{
"extends": [
"react-app",
"plugin:jsx-a11y/recommended",
"plugin:prettier/recommended"
],
"plugins": ["jsx-a11y", "prettier"],
"rules": {
"prettier/prettier": [
"error",
@abhishekbhardwaj
abhishekbhardwaj / Dockerfile
Created October 14, 2018 11:32
Add Nginx to WordPress's official FPM binaries and let users customize php settings
FROM wordpress:4.9-php7.2-fpm-alpine
# Install the extra packages.
RUN apk --no-cache add nginx supervisor curl
# Copy all files.
COPY ./php.ini $PHP_INI_DIR/conf.d/wp_php.ini
COPY ./nginx.conf /etc/nginx/nginx.conf
COPY ./supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Disable default entrypoint.
ENTRYPOINT []
# Expose Nginx on 80.
@abhishekbhardwaj
abhishekbhardwaj / build-emoji-regexp.php
Created December 13, 2018 05:50 — forked from ravisorg/build-emoji-regexp.php
Generate a PHP compatible regular expression to match emoji from the most recent unicode data.
<?php
/**
* Uses the data from unicode.org's emoji-data.txt to build a PHP compatible Regular Expression
* along the lines of:
* (?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\x{FE0F}?)
*
* To use: php build-hashtag-regexp.php <emoji-data.txt>
* Output will be the generated regular expression.
*
@abhishekbhardwaj
abhishekbhardwaj / test-hashtag-regexp.php
Created December 13, 2018 05:50 — forked from ravisorg/test-hashtag-regexp.php
pnut.io unicode hashtag parser
<?php
// You can find the test data file at https://www.ravis.org/hashtag-test.zip
// You're gonna want to have your console output supporting UTF8 before running this, or you're
// gonna see a bunch of ? in the output...
// For curiosity's sake, post number 693,847 is an emoji hashtag: #(heart)
@abhishekbhardwaj
abhishekbhardwaj / whois.db.sh
Created December 17, 2018 07:48 — forked from kolobus/whois.db.sh
Get list of all active TLD's w/whois server
#!/bin/bash
# 1
wget -qO root.zone http://www.internic.net/domain/root.zone
# 2
cat root.zone | grep "IN\sNS" | awk '{print $1}' | uniq | sort | sed -r 's/\.//g' | sed '/^$/d' > zone.list 2> /dev/null
# 3
@abhishekbhardwaj
abhishekbhardwaj / .eslintrc
Last active March 8, 2019 11:13
Setup ESLint + Prettier for Vue.js Development.
{
"env": {
"browser": true,
"commonjs": true,
"es6": true
},
"extends": [
"eslint:recommended",
"airbnb-base",
"plugin:vue/recommended",
@abhishekbhardwaj
abhishekbhardwaj / .eslintrc
Created March 19, 2019 20:58
ESLint for Typescript powered React Native Projects
{
"parser": "@typescript-eslint/parser",
"extends": [
"plugin:@typescript-eslint/recommended",
"universe/native",
"plugin:prettier/recommended"
],
"plugins": ["@typescript-eslint"],
"settings": {
"import/resolver": {
@abhishekbhardwaj
abhishekbhardwaj / gist:edf62514302eaca83077a1d3d71e916e
Created March 21, 2019 03:42
Convert Tailwind Colors to PascalCase for ReactNative.
const _ = require('lodash');
// https://tailwindcss.com/docs/colors/#default-color-palette
let colors = {
'transparent': 'transparent',
'black': '#22292f',
'grey-darkest': '#3d4852',
'grey-darker': '#606f7b',
'grey-dark': '#8795a1',