Skip to content

Instantly share code, notes, and snippets.

/*
* Author: Jay Vi
*
*/
Install AdMobPro
https://github.com/santonocito/angular-admobpro
2. Dependencies :
2.1 sudo cordova plugin add cordova-plugin-extension
-- https://github.com/floatinghotpot/cordova-extension
2.2 bower install angular-admobpro --save
@jayvi
jayvi / gist:de15d132d50cbe12a07a
Created December 18, 2015 20:46 — forked from jcsrb/gist:1081548
get avatar from google profiles, facebook, gravatar, twitter, tumblr
function get_avatar_from_service(service, userid, size) {
// this return the url that redirects to the according user image/avatar/profile picture
// implemented services: google profiles, facebook, gravatar, twitter, tumblr, default fallback
// for google use get_avatar_from_service('google', profile-name or user-id , size-in-px )
// for facebook use get_avatar_from_service('facebook', vanity url or user-id , size-in-px or size-as-word )
// for gravatar use get_avatar_from_service('gravatar', md5 hash email@adress, size-in-px )
// for twitter use get_avatar_from_service('twitter', username, size-in-px or size-as-word )
// for tumblr use get_avatar_from_service('tumblr', blog-url, size-in-px )
// everything else will go to the fallback
// google and gravatar scale the avatar to any site, others will guided to the next best version
@jayvi
jayvi / cluster.md
Created October 18, 2016 18:22 — forked from learncodeacademy/cluster.md
Node Cluster - Enhance your node app by using all the cores of your processor.

Here's all you have to do to add clustering to your node.js application.

  • save this code as cluster.js, and run cluster.js instead of server.js (or /bin/www, or whatever it's called for your project)
  • the only line you'll need to change is the last line - it needs to point to the location of your server.js file
var cluster = require('cluster');

if (cluster.isMaster) {
  // Count the machine's CPUs
 var cpuCount = require('os').cpus().length;
@jayvi
jayvi / html_form
Created March 9, 2017 13:19 — forked from zvineyard/html_form
PHP: Upload and Rename File
<form action="" enctype="multipart/form-data" method="post">
<input id="file" name="file" type="file" />
<input id="Submit" name="submit" type="submit" value="Submit" />
</form>
@jayvi
jayvi / codeigniter.multiple.file.upload.php
Created March 9, 2017 16:08
Trick to upload multiple files using CodeIgniter's Upload Library
<?php
/*
* Code above omitted purposely
* In your HTML form, your input[type=file] must be named *userfile[]*
*/
/*
* Uploads multiple files creating a queue to fake multiple upload calls to
* $_FILE
*/
@jayvi
jayvi / install-docker.sh
Created March 29, 2018 14:30 — forked from frgomes/install-docker.sh
Debian - install docker in Debian Jessie
#!/bin/bash
# compiled from https://docs.docker.com/engine/installation/linux/debian/#/debian-jessie-80-64-bit
sudo apt-get update
sudo apt-get dist-upgrade -y
sudo apt-get install apt-transport-https ca-certificates -y
sudo sh -c "echo deb https://apt.dockerproject.org/repo debian-jessie main > /etc/apt/sources.list.d/docker.list"
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
@jayvi
jayvi / functions.php
Created September 8, 2018 09:59 — forked from kozzmen/functions.php
Add BGN support for PayPal
// allow BGN for WooCommerce and PayPal
add_filter( 'woocommerce_currencies', 'add_bgn_currency' );
function add_bgn_currency( $currencies ) {
$currencies['BGN'] = __( 'Bulgarian Lev (лв.)', 'woocommerce' );
return $currencies;
}
add_filter('woocommerce_currency_symbol', 'add_bgn_currency_symbol', 10, 2);
@jayvi
jayvi / nginx.conf
Created October 2, 2018 08:09 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@jayvi
jayvi / ssh.md
Created November 30, 2018 13:40 — forked from bradtraversy/ssh.md
SSH & DevOps Crash Course Snippets

SSH Cheat Sheet

This sheet goes along with this SSH YouTube tutorial

Login via SSH with password (LOCAL SERVER)

$ ssh brad@192.168.1.29

Create folder, file, install Apache (Just messing around)

$ mkdir test

$ cd test

@jayvi
jayvi / curl.md
Created February 23, 2019 19:30 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.