Skip to content

Instantly share code, notes, and snippets.

@GarryOne
GarryOne / docker-compose.yml
Created December 20, 2019 16:02
PHP Zend docker-compose.yml
version: "3.1"
services:
web:
build: .
container_name: samsa
restart: always
volumes:
- .:/var/www/html
depends_on:
@GarryOne
GarryOne / Dockerfile
Created December 20, 2019 15:28
PHP Zend app Dockerfile
FROM php:7.1-apache
ARG GITHUB_TOKEN=x
# Install packages
RUN apt-get update && apt-get install -y \
git \
nano
# PHP Extensions
@GarryOne
GarryOne / arrayToExcelDownload.php
Last active January 30, 2019 13:51
PHPExcel arrayToExcelDownload() function
<?php
function arrayToExcelDownload($data, $filename = FALSE) {
if(!isset($filename)) {
$filename = 'crm_export_' . date('m.d.Y') . 'xlsx';
}
$excel = new PHPExcel();
$excel->setActiveSheetIndex(0);
@GarryOne
GarryOne / insta_login_check.js
Created September 8, 2018 21:27
Puppeteer Instagram Credentials/Login Verification
// start the node server by doing: `node insta_login_check.js`
const puppeteer = require('puppeteer');
const delay = require('delay');
const user = {
username: 'user@test.com',
password: 'passw0rd',
};
@GarryOne
GarryOne / AdobeCEP_Extension_helpers.jsx
Created July 28, 2018 13:43
Photoshop CEP Extension Helper Functions
function s2t(s) { return app.stringIDToTypeID(s); }
function t2s(t) { return app.typeIDToStringID(t); }
// Select the Tool corresponding to the passed stringID
function selectTool(stringID){
var d = new ActionDescriptor();
var r = new ActionReference();
r.putClass( s2t(stringID) );
d.putReference( s2t("target"), r);
d.putBoolean( s2t("dontRecord"), true );
@GarryOne
GarryOne / http-security-headers.php
Created May 29, 2018 22:13
PHP HTTP Security Headers
<?php
header('Strict-Transport-Security: max-age=63072000; includeSubDomains; preload'); // if ssl enabled
header('X-Frame-Options: SAMEORIGIN');
header('X-XSS-Protection: 1; mode=block');
header('X-Content-Type-Options: nosniff');
header('Content-Type: text/html; charset=utf-8');
header('Access-Control-Allow-Origin: '.$_SERVER['HTTP_ORIGIN']);
header('Expect-CT: max-age=7776000, enforce');
header('Referrer-Policy: origin-when-cross-origin');
import java.util.Scanner;
import java.util.Random;
public class Shindra {
public static int NR_CARDS = 9;
public static int [][] tab = new int[4][4];
public static int [][] _humanTab = new int[4][4];
public static int [][] _computerTab = new int[4][4];
<?php
ini_set("display_errors", 1);
date_default_timezone_set('Europe/Bucharest');
$im = imagecreatefromjpeg('ctp.jpg');
$font = 'Roboto-Regular.ttf';
// Ex: 17:01 in 11/12/2016
$text = date('H:i \i\n d/m/Y', strtotime('+ 1 day -4 minute'));
$color = imagecolorallocate($im, 0, 0, 0);