Skip to content

Instantly share code, notes, and snippets.

View jkanclerz's full-sized avatar
🎯
Focusing

Jakub Kanclerz jkanclerz

🎯
Focusing
View GitHub Profile
WebApp
@jkanclerz
jkanclerz / form-spinner.js
Created April 5, 2014 23:47
Form submit spinner
;(function ( $ ) {
'use strict';
$(document).ready(function() {
$('form').bind('submit', function() {
$(this).find('button[type="submit"] i').attr('class', 'glyphicon glyphicon-refresh animate');
});
});
})( jQuery );
@jkanclerz
jkanclerz / form-ajax-submiter.js
Created April 5, 2014 23:54
file upload with progress bar
function progressHandler(event){
$("#kb_of_total").text("Uploaded "+Math.round(event.loaded/1024) +" kb of "+Math.round(event.total/1024));
var percent = (event.loaded / event.total) * 100;
$("#progressBar").attr('value', Math.round(percent));
$("#status").text(Math.round(percent)+"% uploaded... please wait");
}
function completeHandler(event){
$("#progressBar").attr('value', 100);
$("#status").text('Uploaded Success');
successHandler(event);
@jkanclerz
jkanclerz / style.css
Created May 5, 2014 07:51
Fix div(element) element hight 0
#element:after, .element:after {
content: "";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
create database databasename;
create user 'user' identified by 'password';
grant all privileges on databasename.* to 'user'@localhost identified by 'password';
grant all privileges on databasename.* to 'user'@host;
grant all privileges on databasename.* to 'user'@%;
@jkanclerz
jkanclerz / Kernel.php
Last active August 29, 2015 14:07
Vagrant Env SF2 - Kernel Mod
public function getCacheDir()
{
if ($this->isVagrantEnvironment()) {
return '/dev/shm/project/cache/'.$this->environment;
}
return parent::getCacheDir();
}
public function getLogDir()
@jkanclerz
jkanclerz / PaymentHandler.php
Last active August 29, 2015 14:14
Redirect to dotpay - Pay Action
<?php
namespace Jkanclerz\DemoBundle\Payment;
use Symfony\Component\HttpFoundation\Request;
class PaymentHandler
{
const TRANSACTION_OK = 'OK';
const TRANSACTION_ERROR = 'ERROR';
@jkanclerz
jkanclerz / deploy.sh
Created March 10, 2015 16:35
Remote Command Execution by ssh
#!/bin/bash
echo "deploy Was started"
hostname -f;
uptime;
for package in $@
do
echo $package
if [ "$(rpm -qa | grep -E "^$package")" != "" ]
class CallbackExecutor
{
protected $callback;
public function __call($method, $args)
{
if(is_callable(array($this, $method))) {
return call_user_func_array($this->$method, $args);
}
// else throw exception
@jkanclerz
jkanclerz / gist:f8cd0adb5f01ae007fe0
Created April 28, 2015 15:13
Linux NFS Redundant Storage

Redundant storage with NFS & Heartbeat

Wymagane zależności

apt get install ntp drbd8-utils heartbeat

Zróbmy to!