As configured in my dotfiles.
start new:
tmux
start new with session name:
/*! | |
* classie - class helper functions | |
* from bonzo https://github.com/ded/bonzo | |
* | |
* classie.has( elem, 'my-class' ) -> true/false | |
* classie.add( elem, 'my-new-class' ) | |
* classie.remove( elem, 'my-unwanted-class' ) | |
*/ | |
/*jshint browser: true, strict: true, undef: true */ |
// icon | |
// http://www.emoji-cheat-sheet.com/ | |
// for test use direct message e.g. @kiichi | |
let payload = "payload={\"channel\": \"#dev\", \"username\": \"bot\", \"icon_emoji\":\":calling:\", \"text\": \"hello\"}" | |
let data = (payload as NSString).dataUsingEncoding(NSUTF8StringEncoding) | |
if let url = NSURL(string: "https://hooks.slack.com/services/(your slack incoming webhook url)") | |
{ | |
var request = NSMutableURLRequest(URL: url) | |
request.HTTPMethod = "POST" |
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage' | |
STATICFILES_STORAGE = 'path.to.storage.S3StaticStorage' | |
THUMBNAIL_DEFAULT_STORAGE = 'storages.backends.s3boto.S3BotoStorage' | |
AWS_ACCESS_KEY_ID = 'YOUR KEY' | |
AWS_SECRET_ACCESS_KEY = 'YOUR KEY' | |
AWS_STORAGE_BUCKET_NAME = 'media.YOURSITE.com' | |
AWS_STATIC_BUCKET_NAME = 'static.YOURSITE.com' | |
AWS_S3_CUSTOM_DOMAIN = AWS_STORAGE_BUCKET_NAME | |
AWS_STATIC_CUSTOM_DOMAIN = AWS_STATIC_BUCKET_NAME | |
STATIC_URL = 'http://%s/' % AWS_STATIC_BUCKET_NAME |
import os | |
import requests | |
import sys | |
import pprint | |
''' | |
Description: | |
Allows to list and delete user pm cards using Paymentez API. For development testing purposes only. | |
Usage: | |
Make sure you have requests installed with pip install requests. |
# API authentication | |
from social.apps.django_app.utils import strategy | |
from rest_framework.authtoken.models import Token | |
from rest_framework.views import APIView | |
from rest_framework import parsers | |
from rest_framework import renderers | |
from rest_framework.authentication import get_authorization_header | |
from rest_framework.response import Response |
# Reference: https://www.igvita.com/2007/02/13/building-dynamic-webrick-servers-in-ruby/ | |
require 'webrick' | |
class Echo < WEBrick::HTTPServlet::AbstractServlet | |
def do_GET(request, response) | |
puts request | |
response.status = 200 | |
end | |
def do_POST(request, response) | |
puts request |
// Replace letters | |
@function str-replace($string, $search, $replace: '') { | |
$index: str-index($string, $search); | |
@if $index { | |
@return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace); | |
} | |
@return $string; | |
} |
This is an example how to perform multi-select faceting in ElasticSearch. | |
Selecting multiple values from the same facet will result in an OR filter between each of the values: | |
(facet1.value1 OR facet1.value2) | |
Faceting on more than one facet will result in an AND filter between each facet: | |
(facet1.value1 OR facet1.value2) AND (facet2.value1) | |
I have chosen to update the counts for each facet the selected value DOES NOT belong to since we are performing an AND between each facet. I have included an example that shows how to keep the counts if you don't want to do this (filter0.sh). |
As configured in my dotfiles.
start new:
tmux
start new with session name: