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
@cursedcoder
cursedcoder / server.js
Created March 31, 2018 06:14
Compare express.js with amphp/http-server
var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.send('Hello World!');
});
app.listen(3000, function () {
console.log('Running on port 3000.');
});
cursedcoder@macohost ~/vendor/react ±master[∆] » cloc react/src
84 text files.
84 unique files.
20 files ignored.
http://cloc.sourceforge.net v 1.60 T=0.34 s (189.3 files/s, 14875.2 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
PHP 64 965 595 3470
cursedcoder@localhost ~/Projects/socks ±master[√] » php examples/server.php &
[1] 51255
SOCKS server listening on localhost:9050
cursedcoder@localhost ~/Projects/socks ±master[√] » php examples/server-middleman.php &
[2] 51290
SOCKS server listening on localhost:9051 (which forwards everything to SOCKS server 127.0.0.1:9050)
cursedcoder@localhost ~/Projects/socks ±master[√] » php examples/client.php
Demo SOCKS client connecting to SOCKS server 127.0.0.1:9051
@cursedcoder
cursedcoder / test.py
Created January 30, 2014 15:56
Memory leak PyQT5
from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebKitWidgets import QWebView
from PyQt5.QtWebKit import QWebSettings
class Crawler(QWebView):
def __init__(self):
QWebView.__init__(self)
self.settings().setMaximumPagesInCache(0)
@cursedcoder
cursedcoder / config.yml
Last active March 20, 2019 22:00
HWIOAuth with FOSUserBundle intergration + phpspec coverage
fos_user:
db_driver: orm
firewall_name: main
user_class: App\Entity\User
service:
user_manager: app.user_manager
hwi_oauth:
firewall_name: main
fosub:
diff --git a/lib/Github/Api/Repository/Assets.php b/lib/Github/Api/Repository/Assets.php
index ad48aaf..cee57d5 100644
--- a/lib/Github/Api/Repository/Assets.php
+++ b/lib/Github/Api/Repository/Assets.php
@@ -74,7 +74,6 @@ class Assets extends AbstractApi
}
$name = $params['name'];
- $parameters['body'] = $params['body'];
$headers['Content-Type'] = $params['content-type'];
@cursedcoder
cursedcoder / wtf.md
Last active December 14, 2015 04:19

Good:

interface MyInterface
{
  function foo();
}

class MyClass implements MyInterface
{
<?php
`apt-get update && sudo apt-get upgrade && apt-get install nginx php5-fpm -y`;
$nginx = <<<TEXT
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
}
http {
sendfile on;
@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: