Skip to content

Instantly share code, notes, and snippets.

View ivanproskuryakov's full-sized avatar
🏢
https://github.com/communa

Ivan ivanproskuryakov

🏢
https://github.com/communa
View GitHub Profile
@MrOrz
MrOrz / test_readability.js
Created March 19, 2018 16:42
Test web page summarization with Mozilla/Readability.js and puppeteer
const DOC_URL = process.argv[2];
const puppeteer = require('puppeteer');
const fs = require('fs');
const readabilityJsStr = fs.readFileSync('node_modules/readability/Readability.js', {encoding: 'utf-8'})
function executor() {
return new Readability({}, document).parse();
}
@Tjorriemorrie
Tjorriemorrie / JsonSerializerListener.php
Created March 6, 2014 12:38
Listener for JMS Serializer
<?php
namespace Talentec\MainBundle\Listener;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
use Doctrine\Common\Annotations\Reader;
@KushalP
KushalP / json_log_decode.lua
Created January 23, 2014 19:51
Example of a Heka Lua Sandbox decoder that will take JSON log lines (and some extra decoder config) and stream that information into the `Fields` variables of the Heka message.
require "cjson"
-- Generic decoder for JSON logs. This will extract all JSON
-- keys and add them to the `Fields` variable of the created
-- Heka message.
--
-- Example use:
--
-- [NginxJsonLogDecoder]
-- type = "SandboxDecoder"
@joseraya
joseraya / snapshot-crawler.js
Created January 21, 2014 20:15
A node script that crawls a web site and stores snapshots (taken with zombie.js) to the file system. Based on code from this article: http://www.ng-newsletter.com/posts/serious-angular-seo.html
var Browser = require('zombie'),
url = require('url'),
fs = require('fs'),
$q = require('Q'),
saveDir = __dirname + '/_snapshots';
var scriptTagRegex = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;
var stripScriptTags = function(html) {
@amitaibu
amitaibu / hosts
Last active October 3, 2016 03:11
ExpressJS + AngularJS subdomain login.
# /etc/ hosts
# For local developement
127.0.0.1 app.local
127.0.0.1 api.app.local
@silviuvoicu
silviuvoicu / BookController.php
Created August 20, 2013 07:39
Spec with phpspec a symfony2 controller. I know which is the normal work flow: write first the spec, and then the code, but in order to understand better how to spec a symfony2 controller, I first create a simple book entity with just id and name, and then with the help of generators I created a crud system, which I modified a little. Then havin…
<?php
namespace Acme\DemoBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Acme\DemoBundle\Entity\Book;
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active June 5, 2024 22:16 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.