Skip to content

Instantly share code, notes, and snippets.

View cemk's full-sized avatar
🎨
Look ma, no code!

Cem K. cemk

🎨
Look ma, no code!
View GitHub Profile
const fetch = require('node-fetch');
async function run() {
let username = "YOUR USERNAME HERE";
let password = "YOUR APP PASSWORD";
let authBasic = new Buffer(username + ':' + password).toString('base64');
let session = await (await fetch('https://jmap.fastmail.com/.well-known/jmap', {
headers: {
"Authorization": "Basic " + authBasic
}
})).json();
<meta property="og:title" content="{{ .Title }}" />
<meta property="og:description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}" />
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" />
{{ with .Params.images }}{{ range first 6 . }}
<meta property="og:image" content="{{ . | absURL }}" />
{{ end }}{{ end }}
{{ if .IsPage }}
{{ if not .PublishDate.IsZero }}<meta property="article:published_time" content="{{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | safeHTML }}"/>
{{ else if not .Date.IsZero }}<meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}"/>{{ end }}
@stowball
stowball / accessible-web-links.md
Last active May 22, 2017 20:00
Building a better, accessible web linked resources
@pbausch
pbausch / pinpoptweets.js
Last active December 20, 2016 03:13
Embed Tweets on the Pinboard Popular Page with Tampermonkey
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description embed tweets on Pinboard Popular page
// @author You
// @match https://pinboard.in/popular/
// @grant none
// ==/UserScript==
@JacobBennett
JacobBennett / blog.md
Last active March 26, 2021 02:47
API Token Authentication in Laravel 5.2 & 5.3

I recently had the need to write a small url shortening application. I am aware that this problem has been solved quite a few times before, but what is being a developer if not reinventing the wheel just for the heck of it? Custom CMS anyone?

Knowing that this was going to be a tiny RESTful API and also knowing that Laravel 5.2 had API rate limiting built in, I was eager to give it a try. Taylor Otwell being Taylor Otwell shipped 5.2 with the rate limiting defaults set up out of the box and I had my application building out short url's in a matter of minutes. The problem for me came when I wanted to start associating those short urls with a user.

Typically my applications have a UI and authentication is done through a simple login page. Obviously for a RESTful API, having a login page isn't ideal. Instead, my hope was to have users append an api_token to the end of their query string and use that to auth

@bastianallgeier
bastianallgeier / statify.php
Last active October 4, 2022 17:12
A first draft for a script, which converts a Kirby site into a static site. It's a rough first draft, so don't expect it to be perfect. Play with it, if you like it!
<?php
/**
* Instructions:
*
* 1. Put this into the document root of your Kirby site
* 2. Make sure to setup the base url for your site correctly
* 3. Run this script with `php statify.php` or open it in your browser
* 4. Upload all files and folders from static to your server
* 5. Test your site
@Rob--W
Rob--W / .bashrc
Last active July 1, 2022 14:52
upto / jd to quickly navigate between directories in bash.
# Based on http://unix.stackexchange.com/questions/14303/bash-cd-up-until-in-certain-folder/14311#14311
# Jump to closest matching parent directory
upto () {
if [ -z "$1" ]; then
return
fi
local upto=$@
cd "${PWD/\/$upto\/*//$upto}"
}
# Auto-completion
@JeffreyWay
JeffreyWay / snippet.xml
Created September 13, 2012 20:23
Laravel Resource - Sublime Text 2 Snippet
<snippet>
<content><![CDATA[
// ${1} Resource
Route::get('${1}s', array('as' => '${1}s', 'uses' => '${1}s@index'));
Route::get('${1}s/(:any)', array('as' => '${1}', 'uses' => '${1}s@show'));
Route::get('${1}s/new', array('as' => 'new_${1}', 'uses' => '${1}s@new'));
Route::get('${1}s/(:any)edit', array('as' => 'edit_${1}', 'uses' => '${1}s@edit'));
Route::post('${1}s', '${1}s@create');
Route::put('${1}s/(:any)', '${1}s@update');
Route::delete('${1}s/(:any)', '${1}s@destroy');
@geedelur
geedelur / ubuntu12server_mate.textile
Created July 30, 2012 16:18
Ubuntu Server 12.04 + MATE + LightDM
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#