Skip to content

Instantly share code, notes, and snippets.

View dimkir's full-sized avatar
🎯
Focusing

dimkir

🎯
Focusing
View GitHub Profile
@jordanorelli
jordanorelli / gif_example.pde
Created February 20, 2013 02:38
make an animated gif with Processing
import gifAnimation.*;
GifMaker gifExport;
int frames = 0;
int totalFrames = 120;
public void setup() {
smooth();
size(400, 400);
@bastman
bastman / aws-cli-cognito-get-open-id-token-for-developer-identity.md
Last active May 2, 2021 15:43
aws cognito examples (bash / php): custom auth provider

Aws Cognito: Custom Auth (Developer Authenticated Identities)

How to get OpenID Token & IdentityId from AWS Cognito?

  • example: using bash (aws cli sdk)
  • example: using php (aws php sdk v3.*)

note

  • you need to add example.com as custom auth provider in aws console (cognito/federated)
@mdellabitta
mdellabitta / gist:1444003
Created December 7, 2011 18:32
how do do spring jdbc transactions with jdbctemplate/transactiontemplate
public class ExodusWriter {
private JdbcTemplate jdbcTemplate;
private TransactionTemplate transactionTemplate;
public ExodusWriter(DataSource dataSource) {
DataSourceTransactionManager transactionManager = new DataSourceTransactionManager(dataSource);
jdbcTemplate = new JdbcTemplate(transactionManager.getDataSource());
transactionTemplate = new TransactionTemplate(transactionManager);
}
@sintaxi
sintaxi / regions.txt
Last active March 28, 2022 02:12
Surge Regions
List of regions your project is served from when you deploy using surge.
yyz.surge.sh : 159.203.50.177 : CA : Toronto
jfk.surge.sh : 159.203.159.100 : US : New York
sfo.surge.sh : 138.197.235.123 : US : San Francisco
lhr.surge.sh : 46.101.67.123 : GB : London
ams.surge.sh : 188.166.132.94 : NL : Amsterdam
fra.surge.sh : 138.68.112.220 : DE : Frankfurt
sgp.surge.sh : 139.59.195.30 : SG : Singapore
@kevindice
kevindice / react-app-s3-sync.sh
Created January 27, 2019 02:19
A shell script for uploading a React app build to S3 + CloudFront for deployment
#!/bin/bash
S3_BUCKET_NAME=$1
CF_ID=$2
# Sync all files except for service-worker and index
echo "Uploading files to $S3_BUCKET_NAME..."
aws s3 sync build s3://$S3_BUCKET_NAME/ \
--acl public-read \
--exclude service-worker.js \
@yyogo
yyogo / spliterr.sh
Last active January 23, 2024 10:37
Split stderr from comand to separate tmux pane
#!/bin/bash
set -m
showhelp() {
echo "Usage: $0 [-ohvrc] <command>"
echo "Pipes stderr from command to a new tmux pane."
echo " -h | -v split horizontally or vertically (default vertically)"
echo " -r send stdout to pane instead of stderr"
echo " -o send both stdout and stderr to new panes"
echo " -c close pane automatically after program terminates"
@mvriel
mvriel / gist:3822861
Created October 2, 2012 19:49
Option arrays in PHPDoc
<?php
/*
This code sample demonstrates several style for representing an option array with
the following fields: name, label, type_id, visible, default.
When designing this we should keep in mind that the option key may be represented
by either a literal or a (class)constant. As such we mix and match those for
illustrative purposes.
*/
@lashex
lashex / aws-iot-mosquitto
Created May 23, 2016 21:05
Example Mosquitto CLI pub/sub using AWS IoT MQTT endpoint
The Mosquitto Pub CLI
$> mosquitto_pub --cert thing-0.pem --key thing-0.prv --cafile aws-iot-rootCA.crt -h XXXXXXXXYYYYY.iot.us-west-2.amazonaws.com -p 8883 -t 'test/thing' -m "Hello from Mosquitto"
The Mosquitto Sub CLI
$ mosquitto_sub --cert thing-0.pem --key thing-0.prv --cafile aws-iot-rootCA.crt -h XXXXXXXXYYYYY.iot.us-west-2.amazonaws.com -p 8883 -t 'test/+'
@paulirish
paulirish / what-forces-layout.md
Last active April 30, 2024 17:56
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';