Skip to content

Instantly share code, notes, and snippets.

View tadas-s's full-sized avatar
🍍
( ⚆ _ ⚆ ) ┬───────┬

Tadas Sasnauskas tadas-s

🍍
( ⚆ _ ⚆ ) ┬───────┬
View GitHub Profile
<?php
$json = array(
'values' => array(
0 => array(
'field' => 'id1',
'value' => 895
),
1 => array(
'field' => 'id2',
if Rails.env.test?
module ActionDispatch
module Routing
module UrlFor
alias_method :original_url_options, :url_options
def url_options
if self.respond_to? :request
original_url_options.merge({:host => request.host, :port => request.port})
else
@tadas-s
tadas-s / www-data-writeable.sh
Last active August 29, 2015 13:58
www-data-writeable
#!/bin/bash
#
# Sets-up ACL for current + www-data users to allow writing to folder by both and deleting files created by each other.
# This simplifies some Symfony2 dev tasks
#
# *** NOT TO BE USED IN PRODUCTION SERVERS IN ANY WAY ***.
#
if [ -z "$1" ]; then
@tadas-s
tadas-s / AppKernel.php
Last active August 29, 2015 14:00
Relocate tmp folder on Symfony2
<?php
use Symfony\Component\HttpKernel\Kernel;
class AppKernel extends Kernel
{
/* ... everything else is skipped ... */
public function getCacheDir()
@tadas-s
tadas-s / gist:dae6a8f506993da19993
Created July 7, 2014 08:34
xdebug cli script from vagrant machine
# Say project domain in PhpStorm is configured as example.org and your VM IP is xxx.xxx.xxx.yyy:
PHP_IDE_CONFIG=serverName=example.org php -dxdebug.remote_autostart=1 -dxdebug.remote_host=xxx.xxx.xxx.1 -f ./app/console.php -- console:args --go-here
# with xdebug log (useful for troubleshooting)
PHP_IDE_CONFIG=serverName=example.org php -dxdebug.remote_log="./xdebug.log" -dxdebug.remote_autostart=1 -dxdebug.remote_host=xxx.xxx.xxx.1 -f ./app/console.php -- console:args --go-here
@tadas-s
tadas-s / gist:c247ac75e6418871455c
Created November 19, 2014 16:29
AngularJS + ui-router debug snippet
app.run(function($rootScope) {
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
console.group('$stateChangeStart ' + fromState.name + ' => ' + toState.name);
console.group('from:');
console.log(fromState);
console.log(fromParams);
console.groupEnd();
@tadas-s
tadas-s / nocol
Created December 10, 2014 10:15
nocol
#!/bin/bash
# Strips colors/escape sequences from output
#
# Usage: annoying-color-producing-tool | nocol
sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"
@tadas-s
tadas-s / index.html
Last active October 26, 2015 14:29 — forked from alexkalderimis/index.html
Custom mode RefME widget example
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<title>RefME Cite Button</title>
<script src="https://widget.refme-dev.com/scripts/refme-cite.js"></script>
</head>
<body>
<section>
<div class="col">
<div id="citation-button"></div>
ּ_בּ
בּ_בּ
טּ_טּ
כּ‗כּ
לּ_לּ
מּ_מּ
סּ_סּ
תּ_תּ
٩(×̯×)۶
٩(̾●̮̮̃̾•̃̾)۶
backend default {
.host = "127.0.0.2";
.port = "80";
}
sub vcl_recv {
set req.backend = default;
return(lookup);
}