Skip to content

Instantly share code, notes, and snippets.

@jamescmartinez
jamescmartinez / slack_delete.rb
Last active January 4, 2021 21:28
This Ruby script will bulk remove all Slack files older than 30 days. Just add your API token from https://api.slack.com/web#authentication into the token quotes at the top of the file.
require 'net/http'
require 'json'
require 'uri'
@token = ''
def list_files
ts_to = (Time.now - 30 * 24 * 60 * 60).to_i # 30 days ago
params = {
token: @token,
@thluiz
thluiz / httpoison_post_form_request.ex
Created February 1, 2015 21:51
HTTPoison post url encoded form
headers = [
{"Content-Type", "application/x-www-form-urlencoded"},
{"Accept", "text/html"}
]
encoded_text = URI.encode_www_form(text)
body = "text=#{encoded_text}"
case HTTPoison.post(url, body, headers) do
{:ok, %HTTPoison.Response{status_code: 200, body: body}} ->
module Printf
%default total
data Format = FInt Format -- %d
| FString Format -- %s
| FOther Char Format -- [a-zA-Z0-9]
| FEnd --
format : List Char -> Format
@willurd
willurd / web-servers.md
Last active May 23, 2024 20:20
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@JensRantil
JensRantil / example.html
Last active December 16, 2015 17:19
Improvement of http://stackoverflow.com/a/14774995/260805 that handles generated title attribute on timeago tags.
<html ng-app="MyApplication">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script>
<script src="timeago-angular.js" type="text/javascript"></script>
<script src="my-app.js" type="text/javascript"></script>
</head>
<body>
<div ng-controller="myController">
<span class="time-ago" title="{{ myTime }}"></span>
</div>