Skip to content

Instantly share code, notes, and snippets.

@velizarn
velizarn / sendgrid-sample.php
Last active December 24, 2021 10:26
Sample script to send email via SendGrid
<?php
require('path-to-lib/httpful/bootstrap.php');
$url = "https://api.sendgrid.com/api/mail.send.json";
$payload = array(
'to' => "m8r-m3r@mailinator.com",
'from' => "m8r-bahfj31@mailinator.com",
'fromname' => "Delivery team",
@velizarn
velizarn / yandex_translate.js
Last active June 7, 2016 20:01
Yandex.Translate API request for Node.js
var http = require('http'), https = require('https')
var apiKey = process.argv[2];
var _quSelected = process.argv[3] || '';
var _quPrompt = process.argv[4] || '';
var _lang = process.argv[5] || 'en-bg';
@velizarn
velizarn / validate_email.php
Last active August 29, 2015 14:12
Email address validation with Mailgun
<?php
error_reporting(E_ALL);
function validate_email($email)
{
$key = ''; // Setup Mailgun public key
if (function_exists('filter_var')) {
@velizarn
velizarn / eclipse-start.bat
Last active August 29, 2015 14:09
Select Java version and then start Eclipse executable file located in the same directory with runtime parameters "-clean" and "-vm" according to selected JDK.
@echo off
:chooseversion
set /p javaVersion=Please choose Java version (type 6, 7, 8 or 0 for exit): %=%
IF "%javaVersion%" == "6" (
start /d %CD% eclipse.exe -clean -vm "C:/Program Files/Java/jdk1.6.0_45/bin/javaw.exe"
) ELSE IF "%javaVersion%" == "7" (
@velizarn
velizarn / create-css-sprites.php
Last active January 1, 2016 16:39
When you have a number of small images that appear on a page it makes sense to use CSS sprites to speed-up the rendering of your web page. This has two advantages: It reduces the number of HTTP requests a browser has to make to download the images on your page; Speeds up the rendering of the images and the web-page due to limits on the number of…
<?php
error_reporting(E_ALL);
$images_to_load = array(
'C:/img-folder/01.jpg',
'C:/img-folder/02.jpg',
'C:/img-folder/03.jpg',
'C:/img-folder/04.jpg',
'C:/img-folder/05.jpg',