Skip to content

Instantly share code, notes, and snippets.

@BasPH
BasPH / black_selection.sh
Created December 11, 2018 19:53
Black on selection
#!/usr/bin/env bash
set -x
black=$1
input_file=$2
start_line=$3
end_line=$4
# Read selected lines and write to tmpfile
from pyramid.decorator import reify
from .principals import Principals as P
class AccessToken:
def __init__(self, type, user=None, claims=None):
self.type = type
self.user = user
self.claims = claims or []
@mmerickel
mmerickel / .env
Last active August 30, 2018 01:16
DEBUG=yes
AUTH_SECRET=seekrit
AUTH_EXPIRES=3600
HTTPS_ONLY=no
WEB_CONCURRENCY=4
TRUSTED_PROXY=127.0.0.1
BIND_HOST=127.0.0.1
@jasonhuck
jasonhuck / examples.lasso
Created July 18, 2016 18:17
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');
[
/*
Look for net->wait failure and restart Lasso site if it stops working
to prevent issues with POP and SMTP.
Put this file in web root and watch_net_failure_startup.lasso in LassoStartup
Johan Sölve 2015-08-05
http://lasso.2283332.n4.nabble.com/SMTP-and-POP-problems-on-8-6-3-Mac-caused-by-net-gt-wait-td4644107.html
@Ke-
Ke- / oauth_lib.lasso
Last active August 29, 2015 14:24
Tweaked OAuth library from https://github.com/iamjono/lasso-oauth
<?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'
@johansolve
johansolve / patch_email_send.lasso
Last active August 29, 2015 14:14
Patch email_send subject encoding for Lasso 8
[
// [Email_Send2]
//
// This tag is a drop-in replacement for [Email_Send]. It uses [Email_Compose] on the back-end in order
// to create the message to be sent.
//
/* PATCH
* Replaces subject line that is encoded word by word with a subject line that is encoded as a whole.
@jolle-c
jolle-c / jc_session.lasso
Last active July 12, 2016 23:04
Lasso 9 type to handle cookie based sessions
[
/**!
jc_session
Lasso 9 type to handle cookie based sessions
NOTE, as of this release the code is using json_encode/json_decode as a replacement for json_serialize/json_deserialize. If you are running this in an environment prior to Lasso 9.3 you will have to replace all instances of json_encode with json_serialize and json_decode with json_deserialize!
NOTE, if this is an updated version you'll need to add an additional field to the session table. Run the following sql for Mysql:
ALTER TABLE `jc_session`
@chrisconley
chrisconley / notes.sh
Last active August 29, 2015 14:05
Docker Fig with boot2docker and rsync
# This assumes Docker, Fig, and boot2docker have already been installed
# and that you've set up the app specified in Fig's Quick Start at http://www.fig.sh/.
# Try it!
boot2docker init
boot2docker up
export DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375
fig up
# Uh oh, that didn't work, let's set up rsync
@paulherron
paulherron / readme.txt
Created June 18, 2011 11:53
jQuery script to populate a specified input with a suggested slug. For example, if I write 'My Title' in a title field, it can populate the slug field with a suggestion of 'my_title'.
Video demo at http://screencast.com/t/WcjpL2lc.
By default it uses a title field ending in [title] or [name] as the source field, and a field ending in [slug] as the destination. This matches the naming conventions for a framework like CakePHP, i.e. <?php echo $form->input('title'); ?> outputs an input with a name of data[Model][title].
You can override the default source and destination fields by setting document.slugField and document.titleField in JavaScript beforehand:
<script>
document.titleField = "input[name$='[heading]']";
document.slugField = "input[name$='[url_safe_heading]']";
</script>