Skip to content

Instantly share code, notes, and snippets.

View rredpoppy's full-sized avatar

Adrian Rosian rredpoppy

View GitHub Profile
@tfausak
tfausak / wss.hs
Last active August 10, 2021 18:25
Secure WebSockets in Haskell.
-- base ==4.7.0.1
-- bytestring ==0.10.4.0
-- connection ==0.2.4
-- network ==2.4.2.3
-- text ==1.1.0.0
-- websockets ==0.9.3.1
import Control.Concurrent (forkIO)
import Control.Monad (forever, void)
import qualified Data.ByteString as BS
@miguelgrinberg
miguelgrinberg / rest-server.py
Last active March 29, 2024 09:05
The code from my article on building RESTful web services with Python and the Flask microframework. See the article here: http://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask
#!flask/bin/python
from flask import Flask, jsonify, abort, request, make_response, url_for
from flask_httpauth import HTTPBasicAuth
app = Flask(__name__, static_url_path = "")
auth = HTTPBasicAuth()
@auth.get_password
def get_password(username):
if username == 'miguel':
(ns create-draw.opencv
(:import
org.opencv.core.Core
org.opencv.core.Mat
org.opencv.core.MatOfRect
org.opencv.core.Point
org.opencv.core.Rect
org.opencv.core.Scalar
org.opencv.highgui.Highgui
org.opencv.objdetect.CascadeClassifier))
@wichert
wichert / form-example.html
Created November 30, 2012 09:55
WTForms and pyramid integration
<form id="loginForm" method="post" action="${request.route_url('login')}">
<input type="hidden" name="csrf_token" value="${request.session.get_csrf_token()}"/>
<fieldset class="concise">
<metal:field tal:define="name 'came_from'" use-macro="snippets['hidden']"/>
<metal:field tal:define="name 'login'" use-macro="snippets['text']"/>
<metal:field tal:define="name 'password'" use-macro="snippets['password']"/>
</fieldset>
<div class="buttonBar">
<button type="submit" class="default" i18n:translate="">Login</button>
</div>
@ChubV
ChubV / FormType.php
Created November 29, 2012 07:56
Set form values after bind
class FormType extends AbstractType
{
// ....
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('field')
->add(....)
->addEventListener(FormEvents::POST_BIND, array($this, 'postBind'));
}
@malarkey
malarkey / Contract Killer 3.md
Last active April 16, 2024 21:44
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@pitluga
pitluga / core.clj
Created October 29, 2012 18:58
Braintree Clojure Example
(ns braintree-clj.core
(:import [com.braintreegateway BraintreeGateway Environment TransactionRequest Transaction$Type])
(:require [clojure.string :as s]
[hiccup.core :as hiccup]
[hiccup.page-helpers :as page-helper]
[noir.core :as noir]
[noir.request :as noir-req]
@rmrfself
rmrfself / transaction.php
Created May 19, 2012 07:27
How to make transactions in Doctrine 2 using Symfony 2
<?php
// Snippet for Symfony 2 application that uses Doctrine 2 to handle transactions
// It uses the names of the objects/doctrine repositories from the Beta 4 Manual of Symfony 2.
// Get the entity manager
$em = $this->getDoctrine()->getEntityManager();
// suspend auto-commit
$em->getConnection()->beginTransaction();
@datagrok
datagrok / gist:2199506
Last active April 8, 2023 17:36
Virtualenv's `bin/activate` is Doing It Wrong
@aemkei
aemkei / LICENSE.txt
Last active April 12, 2024 21:27 — forked from 140bytes/LICENSE.txt
Binary Tetris - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE