Skip to content

Instantly share code, notes, and snippets.

@merltron-pa
merltron-pa / twitter_streaming_quix.py
Created May 14, 2021 18:05
Code to read from filtered Twitter stream
import requests
import os
import json
import pandas as pd
from datetime import datetime
from quixstreaming import *
certificatePath = "../certificates/ca.cert"
# use the values given in your starter project here
@merltron-pa
merltron-pa / sentiment_analysis.py
Created May 9, 2021 14:14
Sentiment analysis code for tutorial
from transformers import pipeline
import unicodedata
from quixstreaming import *
import signal
import threading
from bs4 import BeautifulSoup
import re
import itertools
import emoji
import traceback
@merltron-pa
merltron-pa / php_jms_article_finalstep.php
Last active November 25, 2020 15:49
PHP / JMS Article: Final Step
<?php
...
class TestAddressController extends AbstractFOSRestController
{
/**
* @Route("/test/address", methods={"POST"})
* @ParamConverter("address", converter="fos_rest.request_body")
*/
@merltron-pa
merltron-pa / php_jms_article_fost_rest.yaml
Last active November 23, 2020 17:12
PHP/JMS Article: Condensed FOS REST config
fos_rest:
body_converter:
enabled: true
allowed_methods_listener: true
format_listener:
rules:
- { path: '^/', prefer_extension: true, fallback_format: json, priorities: [ 'json', 'xml'] }
@merltron-pa
merltron-pa / php_jms_article_addedbodyconverter.php
Last active November 25, 2020 15:50
PHP/JMS Article: Added JUST the body converter
<?php
...
class TestAddressController extends AbstractFOSRestController
{
/**
* @Route("/test/address", methods={"POST"})
* @ParamConverter("address", converter="fos_rest.request_body")
*/
public function post(Address $address): Response
@merltron-pa
merltron-pa / php_jms_article_composer.json
Last active November 25, 2020 10:45
PHP/JMS Article: Composer dependencies
{
"type": "project",
"license": "proprietary",
"require": {
"php": ">=7.2.5",
"ext-ctype": "*",
"ext-iconv": "*",
"symfony/console": "5.1.*",
"symfony/dotenv": "5.1.*",
"symfony/flex": "^1.3.1",
@merltron-pa
merltron-pa / php_jms_article_add_paramconvert.php
Created November 16, 2020 16:29
PHP/JMS Article: Add param converter Lib
<?php
...
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
class TestPuppyController extends AbstractFOSRestController
{
/**
* @var SerializerInterface
*/
@merltron-pa
merltron-pa / php_jms_article_addfosrest.php
Last active November 16, 2020 16:25
PHP/JMS Article: Add FOS Rest lib, update response.
<?php
...
use JMS\Serializer\SerializerInterface;
use FOS\RestBundle\Controller\AbstractFOSRestController;
class TestAddressController extends AbstractFOSRestController
{
/**
* @var SerializerInterface
@merltron-pa
merltron-pa / php_jms_article_EntityExpose.php
Last active November 27, 2020 14:22
PHP/JMS Article: Expose and configure types for entity
<?php
...
use JMS\Serializer\Annotation as Serializer;
/**
* @Serializer\ExclusionPolicy("all")
*/
class Address
@merltron-pa
merltron-pa / php_jms_article_addconstructor_gen.php
Created November 16, 2020 16:09
PHP/JMS Article: Generate rest of constructor
<?php
...
class TestAddressController extends AbstractController
{
/**
* @var SerializerInterface
*/
private $serializer;