Skip to content

Instantly share code, notes, and snippets.

View cursedcoder's full-sized avatar
🐜
Working from nest

Yevhenii Huselietov cursedcoder

🐜
Working from nest
View GitHub Profile
server {
listen 80;
server_name poli.gon;
root /usr/local/www/poli.gon/web;
index app_dev.php index.html index.htm;
try_files $uri $uri/ @rewrite;
<?php
namespace MAD\FileManagerBundle\Core;
class Item {
public function delete() {
}
<?php
namespace MAD\FileManagerBundle\Core;
class Item {
private $path;
private $name;
public function testExample()
{
$fixture = json_encode(array(
'one' => array('id_str' => 1, 'text' => 'asdasdasd'),
'two' => array('id_str' => 2, 'text' => 'asdasdasd2'),
'three' => array('id_str' => 3, 'text' => 'asdasdasd3')
));
$mockedBrowser = $this->getMock(
'Buzz\Browser',
<?php
namespace Knp\Bundle\LastTweetsBundle\Tests\Twitter\LastTweetsFetcher;
use Knp\Bundle\LastTweetsBundle\Twitter\LastTweetsFetcher\ApiFetcher;
use Knp\Bundle\LastTweetsBundle\Twitter\Tweet;
class ApiFetcherTest extends \PHPUnit_Framework_TestCase
{
const CLASSNAME = 'Knp\Bundle\LastTweetsBundle\Twitter\LastTweetsFetcher\ApiFetcher';
<?php
namespace Knp\Bundle\LastTweetsBundle\Tests\Twitter\LastTweetsFetcher;
use Knp\Bundle\LastTweetsBundle\Twitter\LastTweetsFetcher\ApiFetcher;
use Knp\Bundle\LastTweetsBundle\Twitter\Tweet;
class ApiFetcherTest extends \PHPUnit_Framework_TestCase
{
const CLASSNAME = 'Knp\Bundle\LastTweetsBundle\Twitter\LastTweetsFetcher\ApiFetcher';
<?php
if (
!$this->isOauthExists()
&& ('oauth' === $driver
|| (isset($fetcherConfig['options']['method']) && 'oauth' === $fetcherConfig['options']['method']))
) {
throw new \InvalidArgumentException('You should install and enable InoriTwitterBundle');
}
$('textarea').bind('click', function(){
var currentChar = $(this)[0].selectionEnd;
var all = $(this)[0].textLength;
var line = 0;
for (i = 0; i <= all; i++) {
var char = $(this).text()[i];
if (char == "\n") {
line++;
@cursedcoder
cursedcoder / gist:3466385
Created August 25, 2012 14:21
Twig Best Practice

Bad:

<div class="comment">
    <div class="message">some message</div>
    <div class="rate {% if comment.rate > 0%}green{% elseif comment.rate < 0 %}red{% else %}gray{% endif %}">{{ comment.rate }}</div>
</div>

Good:

user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
}
http {
sendfile on;