Skip to content

Instantly share code, notes, and snippets.

View ildarkhasanshin's full-sized avatar
🚀
eat sleep code repeat

ildar r. khasanshin ildarkhasanshin

🚀
eat sleep code repeat
View GitHub Profile
@yura
yura / pdf2jpg.sh
Created November 10, 2010 15:18
script to PDF to JPG using pdftk and imagemagick
#!/bin/bash
# Script to convert PDF file to JPG images
#
# Dependencies:
# * pdftk
# * imagemagick
PDF=$1
<?php
// force download of CSV
// simulate file handle w/ php://output, direct to output (from http://www.php.net/manual/en/function.fputcsv.php#72428)
// (could alternately write to memory handle & read from stream, this seems more direct)
// headers from http://us3.php.net/manual/en/function.readfile.php
header('Content-Description: File Transfer');
header('Content-Type: application/csv');
header("Content-Disposition: attachment; filename=FILENAME.csv");
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
@mloberg
mloberg / mysql.php
Created August 30, 2011 18:00
Simple PHP MySQL Class
<?php
class Mysql{
static private $link = null;
static private $info = array(
'last_query' => null,
'num_rows' => null,
'insert_id' => null
);
@reinink
reinink / gist:1467201
Created December 12, 2011 13:41
Example of how to parse HTML document with phpQuery
<?php
// Include the phpQuery library
// Download at http://code.google.com/p/phpquery/
include 'phpQuery.php';
// Load Mike Fisher's player page on thescore.com
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.thescore.com/nhl/player_profiles/859-mike-fisher');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@wujiyu115
wujiyu115 / gist:python
Created May 14, 2012 08:31
gist:python
import sublime
import sublime_plugin
import os
import sys
import json
import base64
import urllib2
import subprocess
import functools
import webbrowser
@bbrewer97202
bbrewer97202 / css3pulsingcirle
Created September 18, 2012 18:06
Simple CSS3 pulsing circle animation
<html>
<head>
<title></title>
</head>
<body>
<div id="pulser">
<div class="pulse pulse1"></div>
<div class="pulse pulse2"></div>
<div class="pulse pulse3"></div>
@kasparsd
kasparsd / wordpress-plugin-svn-to-git.md
Last active July 6, 2024 15:54
Using Git with Subversion Mirroring for WordPress Plugin Development
@Saicheg
Saicheg / screenshare
Created December 7, 2012 07:46
Share screenshots on Ubuntu using Dropbox
#!/bin/bash
################
# Description:
# This script will take screenshot of your desktop
# or only active window ( running with -u param ),
# copy it to /Dropbox/Public/share/ with uniq name
# and save path to clipboard
#################
# Requirements:
# Dropbox
@sandys
sandys / disable_alt_tab_grouping_ubuntu.sh
Last active November 2, 2017 18:49
Disable grouping of alt-tab behavior in Ubuntu 12.04 through the commandline. No need for installing and clicking through any tools. This can also be automated for mass deployment
gconftool-2 --set --type list --list-type=string /apps/compiz-1/general/screen0/options/active_plugins '[core,composite,opengl,decor,resize,imgpng,unitymtgrabhandles,snap,compiztoolbox,vpswitch,mousepoll,gnomecompat,place,regex,animation,move,staticswitcher,session,unityshell,workarounds]'
gconftool-2 --set /apps/compiz-1/plugins/switcher/screen0/options/prev_all_key --type string "Disabled"
gconftool-2 --set /apps/compiz-1/plugins/switcher/screen0/options/next_all_key --type string "Disabled"
gconftool-2 --set /apps/compiz-1/plugins/switcher/screen0/options/prev_key --type string "Disabled"
gconftool-2 --set /apps/compiz-1/plugins/switcher/screen0/options/next_key --type string "Disabled"
gconftool-2 --set /apps/compiz-1/plugins/unityshell/screen0/options/alt_tab_prev --type string "Disabled"
gconftool-2 --set /apps/compiz-1/plugins/unityshell/screen0/options/alt_tab_forward --type string "Disabled"
@danillab
danillab / translit.php
Last active January 19, 2020 12:25
Транслит для Яндекса
<?php
function translit($str) {
$tr = array("а"=>"a","б"=>"b","в"=>"v","г"=>"g","д"=>"d","е"=>"e","ё"=>"e","ж"=>"j","з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l","м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r","с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h","ц"=>"c","ч"=>"ch","ш"=>"sh","щ"=>"shh","ъ"=>"","ы"=>"y","ь"=>"","э"=>"e","ю"=>"u","я"=>"ya","—"=>"-","«"=>"","»"=>"","…"=>""," "=>"-","№"=>"#");
$str = mb_strtolower($str,'utf-8');
// $str = preg_replace("/\s+/",' ',$str);
$str = strtr(trim($str), $tr);
$str = trim(preg_replace("/\-+/",'-',$str),'- ');
$str = preg_replace('~[^a-z0-9/-]~', '', $str);
return $str;