Skip to content

Instantly share code, notes, and snippets.

@stevepiercy
stevepiercy / session_cookie.lasso
Last active August 29, 2015 14:24
Lasso code that demonstrates the use of sessions and cookies
<?lasso
define oauth_consumer_key => 'key'
define oauth_consumer_secret => 'secret'
define oauth_request_token => 'requestkey'
define oauth_request_secret => 'requestsecret'
define oauth_access_token => 'accesskey'
define oauth_access_secret => 'accesssecret'
define oauth_realm => 'http://term.ie/'
define oauth_request_endpoint => {return 'http://term.ie/oauth/example/request_token.php'}
define oauth_access_endpoint => 'http://term.ie/oauth/example/access_token.php'
@stevepiercy
stevepiercy / webpack.config.js
Created August 14, 2015 13:10
webpack.config.js in attempt to integrate Bootswatch theme Readable
var path = require('path');
var webpack = require('webpack');
var HtmlwebpackPlugin = require('html-webpack-plugin');
var merge = require('webpack-merge');
var Clean = require('clean-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var pkg = require('./package.json');
var TARGET = process.env.TARGET;
@stevepiercy
stevepiercy / index.html
Last active September 18, 2015 20:20
bootstrap-datepicker - After cloning https://github.com/eternicode/bootstrap-datepicker place index.html in the directory and load it
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Datepicker for Bootstrap</title>
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<link id="bs-css" href="https://netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
<link id="bsdp-css" href="dist/css/bootstrap-datepicker3.min.css" rel="stylesheet">
</head>
<body>
@stevepiercy
stevepiercy / views-default.py
Last active February 28, 2016 20:36
if user requests to add_page that already exists, redirect to edit_page
import cgi
import re
from docutils.core import publish_parts
from pyramid.httpexceptions import HTTPFound
from pyramid.view import view_config
from ..models import Page
# regular expression used to find WikiWords
@stevepiercy
stevepiercy / routes.py
Last active February 28, 2016 21:52
refactor check for existing page from view to new_page_factory in authorization step
from pyramid.httpexceptions import (
HTTPNotFound,
HTTPFound,
)
from pyramid.security import (
Allow,
Everyone,
)
from .models import Page
@stevepiercy
stevepiercy / pyvenvex.py
Last active November 7, 2017 21:45 — forked from vsajip/pyvenvex.py
A script which demonstrates how to extend Python 3.3's EnvBuilder, by installing setuptools and pip in created venvs. This functionality is not provided as an integral part of Python 3.3 because, while setuptools and pip are very popular, they are third-party packages.The script needs Python 3.3 or later; invoke it using"python pyvenvex.py -h"fo…
#
# Copyright (C) 2013 Vinay Sajip. New BSD License.
#
import os
import os.path
from subprocess import Popen, PIPE
import sys
from threading import Thread
from urllib.parse import urlparse
from urllib.request import urlretrieve
@stevepiercy
stevepiercy / examples.lasso
Created August 2, 2016 06:36 — forked from jasonhuck/examples.lasso
Lasso 8.x wrapper for Mailchimp API v3
[//lasso
library('mailchimp.lasso');
// create a new mailchimp instance
// NOTE: -verifypeer worked fine for me on Linux, but not Windows
var('mc') = mailchimp( -key='{YOUR_MAILCHIMP_API_KEY}', -version=3.0, -verifypeer=false);
// get all campaigns
$mc->get('/campaigns');
@stevepiercy
stevepiercy / blowfish-demo.lasso
Created January 23, 2017 22:06
A failed attempt to demonstrate the knop_seed and blowfish_encrypt bug
<?lasso
// Demo of blowfish issue
define knop_seedbug => {
local('seed'= string( server_ip) + string( server_name) + response_localpath)
#seed -> removetrailing(response_filepath)
return #seed
}
define knop_blowfishbug => type {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Sortable Demo</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"/>
</head>
<body>
<!-- Simple List -->