Skip to content

Instantly share code, notes, and snippets.

View standa's full-sized avatar

Standa standa

  • Standa
  • Prague, Czech Republic, Europe
View GitHub Profile
@standa
standa / SendEmail.php
Created March 16, 2014 21:06
Send Email Using CodeIgniter
private function sendEmail() {
$this->load->library('email');
$this->config->load('email');
$tos = explode(',', $this->input->post('emaily'));
// print_r($tos);
if (empty($tos)) {

How to successfully install vendors of Symfony2 on Dreamhost Shared

Sometimes, simply running php composer install or php composer update will throw an error at building bootstrap.php time. To resolve this issue, proceed like this:

First, run:

php composer update --no-scripts
@standa
standa / InsertInputFileDynamically.js
Created April 22, 2014 09:43
Insert input file dynamically using javascript
// works on jQuery 1.9+
$(document).on('change', '.soubor', function () {
if ($(this).val() != '') {
var id = $('.soubor').length + 1;
$('<input>', {type: 'file', name: 'soubor'+id, id: 'soubor'+id, 'class': 'soubor form-control'})
.insertAfter($('.soubor').last());
}
});
@standa
standa / designer.html
Created July 20, 2014 14:44
designer
<link rel="import" href="../paper-button/paper-button.html">
<link rel="import" href="../core-animated-pages/core-animated-pages.html">
<link rel="import" href="../core-animated-pages/transitions/hero-transition.html">
<link rel="import" href="../core-animated-pages/transitions/cross-fade.html">
<link rel="import" href="../core-animated-pages/transitions/slide-down.html">
<link rel="import" href="../core-animated-pages/transitions/slide-up.html">
<link rel="import" href="../core-animated-pages/transitions/tile-cascade.html">
<link rel="import" href="../chart-js/chart-js.html">
<polymer-element name="my-element">
@standa
standa / check_digit_besr.php
Created July 28, 2014 13:19
Swiss BESR Invoice Check Digit
// -----------------------------------------------------------------------------
// @author standa | 2014-04-30 | Swiss Rechnung (BESR)
// not guaranteed 100% but seems to work for us
public function calculateCheckDigit($number)
{
$matrix = array(
0 => array(0,9,4,6,8,2,7,1,3,5),
1 => array(9,4,6,8,2,7,1,3,5,0),
@standa
standa / nginx.conf
Created August 21, 2014 09:15 — forked from leon/nginx.conf
server {
listen 80;
server_name localhost;
root /home/website/web;
rewrite ^/app\.php/?(.*)$ /$1 permanent;
try_files $uri @rewriteapp;
location @rewriteapp {
@standa
standa / tailf-magento-nginx.sh
Created February 24, 2015 15:56
magento-nginx-tailf
#!/bin/bash
tail -f /var/log/nginx/error.log -f /www/var/log/exception.log -f /www/var/log/system.log
@standa
standa / post-commit
Last active August 29, 2015 14:16
Git post-commit php email hook
#!/usr/bin/env php
<?php
// Upload as .git/hooks/post-commit
mail(
'standa@example.com',.
implode(' ', array('[GIT]', trim(`hostname`), ' ', trim(`git log -n 1 --oneline`))),
`git log -n 1`,
implode(' ', array('From:', trim(`hostname`), 'git <standa@example.com>'))
@standa
standa / oauth2-client.php
Created March 9, 2015 09:45
PHP League oauth2-client implementation
<?php
ini_set('session.cookie_lifetime', 86400);
ini_set('session.gc_maxlifetime', 86400);
session_set_cookie_params(86400, dirname($_SERVER['REQUEST_URI']));
session_start();
require 'vendor/autoload.php';
@standa
standa / designer.html
Created April 14, 2015 22:14
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;