Skip to content

Instantly share code, notes, and snippets.

View juyal-ahmed's full-sized avatar
:octocat:
Finalizing

Juyal Ahmed juyal-ahmed

:octocat:
Finalizing
View GitHub Profile
@juyal-ahmed
juyal-ahmed / waterline.sails.mongo.native.example.js
Last active November 26, 2015 08:15 — forked from mikermcneil/waterline.sails.mongo.native.example.js
This works in Sails v0.10.0-rc7 (Waterline v0.10.0-rc12)
/**
* PetController
*
* @description :: Server-side logic for managing pets
* @help :: See http://links.sailsjs.org/docs/controllers
*/
module.exports = {
index: function (req,res) {
@juyal-ahmed
juyal-ahmed / dump.vim
Created February 18, 2016 09:50 — forked from mattn/dump.vim
google-calendar-holiday
scriptencoding utf-8
let s:calendar_list = [
\ ['Australian Holidays', 'en.australian#[email protected]'],
\ ['Austrian Holidays', 'en.austrian#[email protected]'],
\ ['Brazilian Holidays', 'en.brazilian#[email protected]'],
\ ['Canadian Holidays', 'en.canadian#[email protected]'],
\ ['China Holidays', 'en.china#[email protected]'],
\ ['Christian Holidays', 'en.christian#[email protected]'],
\ ['Danish Holidays', 'en.danish#[email protected]'],
@juyal-ahmed
juyal-ahmed / 0_reuse_code.js
Created April 11, 2016 07:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@juyal-ahmed
juyal-ahmed / base64.js
Created May 19, 2016 11:55 — forked from jhurliman/base64.js
An extremely simple implementation of base64 encoding / decoding using node.js Buffers (plus url-safe versions)
/*
* base64.js: An extremely simple implementation of base64 encoding / decoding using node.js Buffers
*
* (C) 2010, Nodejitsu Inc.
* (C) 2011, Cull TV, Inc.
*
*/
var base64 = exports;
@juyal-ahmed
juyal-ahmed / indexed.php
Created June 24, 2016 04:51 — forked from qsun/indexed.php
Check if URL is indexed by Google
<?php
function indexed($url) {
$url = 'http://webcache.googleusercontent.com/search?q=cache:' . urlencode($url);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_USERAGENT, 'Chrome 10');
@juyal-ahmed
juyal-ahmed / gist:27d5b82ed5d32100d18cbada0bf2e669
Created August 4, 2016 06:07 — 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
@juyal-ahmed
juyal-ahmed / envato-screenshots-downloader.php
Created November 14, 2017 18:37 — forked from hasinhayder/envato-screenshots-downloader.php
Download large preview images from the envato item's screenshots page
#!/usr/bin/env php
<?php
//usage: php envato-screenshots-downloader.php /path/to/save/screenshots http://url/to/screenshots/page
set_time_limit(0);
$dir = $argv[1];
$source = $argv[2];
print_r($argv);
mkdir ($dir);
$src = file_get_contents($source);
$pattern = '/src="(https:\/\/0.s3[a-zA-Z0-9_\-\.\/%]+)"/i';
@juyal-ahmed
juyal-ahmed / auto-login-from-reg-email.php
Created November 14, 2017 18:38 — forked from butlerblog/auto-login-from-reg-email.php
WordPress auto login from native registration email
<?php
/*
This code snippet can be added to your functions.php file (without the <?php)
to add a query string to the login link emailed to the user upon registration
which when clicked will validate the user, log them in, and direct them to
the home page.
*/
/**
* This first function is hooked to the 'user_register' action which fires
#!/bin/bash
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'
apt-get update
apt-get install -y docker-engine
systemctl enable docker
usermod -aG docker ubuntu
curl -o /usr/local/bin/docker-compose -L "https://github.com/docker/compose/releases/download/1.11.2/docker-compose-$(uname -s)-$(uname -m)"
chmod +x /usr/local/bin/docker-compose
docker-compose -v
FROM php:7.0.4-fpm
RUN apt-get update && apt-get install -y libmcrypt-dev \
mysql-client libmagickwand-dev --no-install-recommends \
&& pecl install imagick \
&& docker-php-ext-enable imagick \
&& docker-php-ext-install mcrypt pdo_mysql