Skip to content

Instantly share code, notes, and snippets.

View ReeMii's full-sized avatar

Remigiusz Loginow ReeMii

  • DCX @ Capgemini Deutschland
  • Munich, Germany
  • X @reemii76
View GitHub Profile
@ReeMii
ReeMii / getcookie.js
Created November 5, 2013 17:50
get cookie
function getCookie(c_name)
{
var c_value = document.cookie;
var c_start = c_value.indexOf(" " + c_name + "=");
if (c_start == -1){
c_start = c_value.indexOf(c_name + "=");
}
if (c_start == -1){
c_value = null;
}else{
@ReeMii
ReeMii / cookieinfo.js
Created November 5, 2013 18:26
informacje o używaniu cookie przez serwis
cookieInfo = {
show : function() {
cookie = getCookie('cookieInfo');
if(cookie == 'true') {
return;
}
$('body').append('<div id="cookieinfo" style="position:fixed;z-index:1000;top:0;width:100%;background-color:#fcce2f;font-family:Helvetica,Arial,sans-serif;font-weight:300;font-size:12px;color:#000;text-align:center;">'+
'<span style="line-height:45px">Dla Państwa wygody ten serwis używa plików cookies i podobnych technologii po to, by dostosować serwis do potrzeb użytkowników oraz w celach statystycznych.</span>'+
@ReeMii
ReeMii / truncate.sql
Created November 8, 2013 08:23
truncate with foreign keys
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE table1;
TRUNCATE table2;
SET FOREIGN_KEY_CHECKS=1;
@ReeMii
ReeMii / slug.php
Last active December 30, 2015 05:39
slug
<?php
namespace Application\View\Helper;
use Zend\View\Helper\AbstractHelper;
use Zend\ServiceManager\ServiceLocatorAwareInterface;
class Slug extends AbstractHelper implements ServiceLocatorAwareInterface
{
public function __invoke($str = null, $replace=array(), $delimiter='-')
{
@ReeMii
ReeMii / select.js
Created December 8, 2013 06:44
select - setting and unsetting
//setting
$('select option:contains("10")').prop('selected', true);
//unsetting
$('select option:selected').removeAttr("selected")
@ReeMii
ReeMii / constraints.sql
Created December 14, 2013 12:47
Use NOT IN to find where constraints are constraining
SELECT column FROM table WHERE column NOT IN
(SELECT intended_foreign_key FROM another_table)
@ReeMii
ReeMii / disable-foreign-key-check.sql
Created January 20, 2014 09:45
disable foreign key check
SET FOREIGN_KEY_CHECKS=0;
@ReeMii
ReeMii / running.sh
Created February 20, 2014 11:31
Check if service is running on remote host and port
nc example.com 587 < /dev/null; echo $?
@ReeMii
ReeMii / image_download.php
Created March 15, 2014 11:11
Download image from url
<?php
function getimg($url, $path, $overwrite = false) {
$imageName= basename($url);
if(file_exists($path.$imageName) && !$overwrite) {
return $path.$imageName;
}
$headers[] = 'Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg';
$headers[] = 'Connection: Keep-Alive';
@ReeMii
ReeMii / console.js
Created April 30, 2014 06:59
console.log patch for IE and class _debug or _d to use instead of console.xxx functions. Minimised version included
if (typeof console === "undefined") {
var console = {
log: function() {},
info: function() {} ,
warn: function() {},
error: function() {}
}
}
_debug = {
log : function(message) {