Skip to content

Instantly share code, notes, and snippets.

View exu's full-sized avatar
🔨
forging testkube

Jacek Wysocki exu

🔨
forging testkube
View GitHub Profile
<?php
echo "Hello from VIM";
<?php
function deployer_autoload($name) {
$libDirs = array(
'./deployer/lib/deployer/',
'./lib/deployer/',
);
foreach ($libDirs as $libDir){
if(strpos($name, '_')>0) {
$filePath = $libDir . str_replace('_','/',$name).'.php';
map <F11> :wall<CR>:!svn commit -m 'changes' %<CR>
@exu
exu / image_to_data.php
Created March 30, 2011 12:37
Image to inline data script
#!/usr/bin/env php
<?php
function data_uri($file, $mime)
{
$contents = file_get_contents($file);
$base64 = base64_encode($contents);
return ('data:' . $mime . ';base64,' . $base64);
}
$url = $mime = false;
@exu
exu / img2data.vim
Created March 31, 2011 22:38
VIM plugin to convert images to embedded html data
function! Img2Data()
python << EOF
import vim, urllib2, base64, mimetypes
from urlparse import urlparse
try:
url = vim.eval('@+')
o = urlparse(url)
file_type = mimetypes.guess_type(url)[0]
<?php
if( '20110204024217300000' == '20110204024217300264' )
echo 'equal';
else
echo 'not equal';
<?php
class dog {
public $name = '';
public function setName($name) {
$this->name = $name;
}
public function getName() {
return $this->name;
#!/usr/bin/env php
<?php
class ServerMonitor {
public $hosts = array(
'wp.pl',
'ukrywamsieglebokopl.tld',
'google.pl',
);
#!/usr/bin/env php
<?php
class ServerMonitor {
public $hosts = array(
'DNS Server' => '10.0.0.215',
'CRM RC' => 'crm.rc.edp',
'CRM Work' => 'crm.w.edp',
'CRM Prod' => 'crm.pl.edp',
'Jenikins' => 'ci.w.edp',
@exu
exu / gist:1231587
Created September 21, 2011 08:41 — forked from JonCrawford/gist:44415
Improved! A slight alteratiion of DHH's dynamic subdomain technique.
# 1) Point *.example.com in your DNS setup to your server.
#
# 2) Setup an Apache vhost to catch the star pointer:
#
# <VirtualHost *:80>
# ServerName *.example.com
# </VirtualHost>
#
# 3) Set the current account from the subdomain
class ApplicationController < ActionController::Base