Skip to content

Instantly share code, notes, and snippets.

@adixchen
adixchen / get_keycloak_access_token.sh
Last active August 31, 2021 14:14
Get Keycloak access token via curl and pretty print it with python
curl \
-d 'client_id=YOUR_KEYCLOAK_CLIENT' \
-d 'username=YOUR_USERNAME' \
-d 'password=YOUR_PASSWORD' \
-d 'grant_type=password' \
'https://YOUR_KEYCLOAK_SERVER_HOST/auth/realms/YOUR_REALM/protocol/openid-connect/token' \
| python -m json.tool
@brianmacarthur
brianmacarthur / flash-app.js
Last active June 4, 2024 13:55
Flash messaging in Express 4: express-flash vs. custom middleware in ejs, handlebars, or jade
var express = require('express');
var cookieParser = require('cookie-parser');
var session = require('express-session');
var flash = require('express-flash');
var handlebars = require('express-handlebars')
var app = express();
var sessionStore = new session.MemoryStore;
// View Engines
@arian
arian / crop.js
Created August 5, 2012 19:33
Cropping images with nodejs streams and imagemagick
var spawn = require('child_process').spawn;
var Stream = require('stream');
/**
* crops and resizes images to our desired size
* @param {Stream} streamIn in stream containing the raw image
* @return {Stream}
*/
exports.cropImage = function(streamIn){
@andybuchanan
andybuchanan / widget-template.js
Created April 12, 2012 19:42 — forked from ehynds/widget-template.js
Attempt at Jquery UI Widget "boilerplate" with local and global variables and functions
// This is my attempt at a Jquery UI Widget boilerplate which expands upon the others I have
// seen. Of particular interest to me is establishing best practices for instance, widget and
// global; variables, arrays, object, functions....
(function($, undefined){
// locals - accessible by all instances but not accessible outside this closure