Skip to content

Instantly share code, notes, and snippets.

@anjan011
anjan011 / php-curl-fetch.php
Last active January 2, 2016 06:02
Fetch an url content using curl
<?php
/**
* Fetch content from an url using curl
*
* @param string $url The URL to fetch content from
* @param array $curlOptions Curl options
*
* @return bool|mixed Returns false if operation fails, else returns content
*/
@anjan011
anjan011 / php-simple-pager.php
Last active December 28, 2015 15:29
Simple page class
<?php
/**
* Created by PhpStorm.
* User: anjan
* Date: 9/30/15
* Time: 9:23 AM
*/
namespace me\anjan\Utils;
@anjan011
anjan011 / php-mysql-variables.php
Created November 25, 2015 17:25
php: mysql variables list
<?php
/**
* Created by PhpStorm.
* User: anjan
* Date: 11/25/15
* Time: 9:21 PM
*/
$host = 'localhost';
$user = 'root';
@anjan011
anjan011 / ubuntu-screencloud-1.2.0-libquazip.so.0-issue-fix.sh
Last active November 20, 2015 17:09
ubuntu: screencloud 1.2.0 libquazip.so.0 issue fix
# copy existing libquazip.so.1.0.0 as libquazip.so.0
# this will make screencloud happy and run merrily
cd /usr/lib/x86_64-linux-gnu/
sudo cp libquazip.so.1.0.0 libquazip.so.0
# life's good! ehh?
@anjan011
anjan011 / git-export-commit-to-tar.sh
Created November 14, 2015 06:24
export committed files from git to a tar ball
#!/usr/bin/env bash
# ---------------------------------------------------------------------
# This script exports committed files to git repo using a commit id
# You can pass the commit id as the first param, if no param is passed
# the latest commit id will be used
# ---------------------------------------------------------------------
# first check if we have a git repo here!
@anjan011
anjan011 / regex-rgba-color-validation.reg
Created November 14, 2015 03:04
RegEx - RGBA color validation
^rgba\(([0]*[0-9]{1,2}|[1][0-9]{2}|[2][0-4][0-9]|[2][5][0-5])\s*,\s*([0]*[0-9]{1,2}|[1][0-9]{2}|[2][0-4][0-9]|[2][5][0-5])\s*,\s*([0]*[0-9]{1,2}|[1][0-9]{2}|[2][0-4][0-9]|[2][5][0-5])\s*,\s*([0-9]*\.?[0-9]+)\)$
@anjan011
anjan011 / is-valid-rgba-color.php
Last active November 14, 2015 03:05
php - Is valid RGBA color?
<?php
/**
* Is Valid RGBA color?
*
* @param $colorString
*
* @return bool
@anjan011
anjan011 / is-valid-rgba-color.js
Created November 14, 2015 02:44
Is valid RGBA color?
/**
* Is the given string a valid RGBA color?
*
* @param colorString
*
* @returns {boolean}
*/
function isValidRgbaColorFormat(colorString) {
@anjan011
anjan011 / php-vimeo-video-thumbnail-url.php
Created November 11, 2015 15:19
php - get vimeo video thumbnail image url
<?php
/**
* Gets the thumbnail url for a vimeo video using the video id. This only works for public videos.
*
* @param string $id The video id.
* @param string $thumbType Thumbnail image size. supported sizes: small, medium (default) and large.
*
* @return string|bool
@anjan011
anjan011 / php-get-vimeo-video-id-from-url.php
Created November 11, 2015 14:39
php - get vimeo video id from url
<?php
/**
* Get Vimeo video id from url
*
* Supported url formats -
*
* https://vimeo.com/11111111
* http://vimeo.com/11111111