Skip to content

Instantly share code, notes, and snippets.

View vovanx's full-sized avatar

Vladimir Khiruntsev vovanx

  • chopochom.com
  • Simferopol
View GitHub Profile
@gdellicarpini
gdellicarpini / aliases_centos.md
Last active April 8, 2024 19:02
Add permanent aliases in Linux CentOS

Aliases for all users

  • Create a file in /etc/profile.d/ directory

      - myAlias.sh
    
  • Define the alias in the file

      alias gotoserver1="ssh user@192.168.1.100"
    
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 3, 2024 18:53
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@mfyz
mfyz / resize_preview.html
Created April 8, 2014 21:49
HTML5 FileReader + canvas resizer to resize & preview before upload an image using jquery.
<!DOCTYPE html>
<html>
<head>
<title>Angular HTML5 Preview, Crop And Upload</title>
<style>
body {
padding: 50px;
font: 16px Helvetica;
}
@umidjons
umidjons / rowHtmlOptionsExpression.md
Created March 31, 2014 10:20
Yii: Add additional `data-` attributes to each row in `CGridView`

Add additional data- attributes to each row in CGridView

Sometimes we need to hold some values from model in data- attributes of tag. But we can't use $data special variable in cell's htmlOptions attributes. Instead of holding data in cell, we can generate data- attributes for rows (tr). For this purpose CGridView has special attribute rowHtmlOptionsExpression.

<?php
$this->widget( 'zii.widgets.grid.CGridView',
[
	'id'                       => 'my-grid',
	'dataProvider'             => $model->search(),
@walkergv
walkergv / php-UA.php
Last active May 20, 2022 09:04
Simple Event Tracking with Measurement Protocol Using cURL and PHP (plus redirect)
<?
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => 'http://www.google-analytics.com/collect?v=1&tid=[UA-XXXXXXXXX-1]&cid=[RANDOM_INTEGER_OR_GUID]&t=event&ec=[EVENT_CATEGORY]&ea=[EVENT_ACTION]&el=[EVENT_LABEL]',
CURLOPT_USERAGENT => 'Vanity-URL-Tracker',
));
$resp = curl_exec($curl);
curl_close($curl);
header("HTTP/1.1 301 Moved Permanently");