Skip to content

Instantly share code, notes, and snippets.

Avatar

Jussi Räsänen jrasanen

View GitHub Profile
@roman01la
roman01la / clojurescript-repl-workflow.md
Last active Jun 7, 2020
ClojureScript REPL Workflow
View clojurescript-repl-workflow.md

ClojureScript REPL Workflow

Short write up on using REPL when developing UIs in ClojureScript.

Hot-reload on save or Eval in REPL?

Everyone's standard approach to hot-reloading is to use a tool (Figwheel or shadow-cljs) that reloads changed namespaces automatically. This works really well: you change the code, the tool picks up changed files, compiles namespaces and dependants, notifies REPL client which then pulls in compiled changes, and re-runs a function that re-renders UI.

The other approach is to use ClojureScript's REPL directly and rely only on eval from the editor. This more or less matches Clojure style workflow. This approach might be useful when you don't want tools overhead or hot-reloading becomes slow for you or you just used to this style of interactions. Also changing code doesn't always mean that you want to reload all the changes. On the other hand it is very easy to change a couple of top-level forms and forget to eval one of them.

@zethon
zethon / gist:dc7a5c71b0ac3cff35017febd1f15511
Last active Jun 27, 2021
Changing the color of macOS app title bar in Qt with CMake
View gist:dc7a5c71b0ac3cff35017febd1f15511

In CMake, add/link the Carbon library to the executable

    FIND_LIBRARY(CARBON_LIBRARY Carbon)
    set(EXTRA_LIBS
        ${CARBON_LIBRARY}

Make sure to add ${CARBON_LIBRARY} in the TARGET_LINK_LIBRARIES call for the executable.

Then create a file to hold the Object-C code, in this case changetitlebarcolor.mm

@gcatlin
gcatlin / glfw-metal-example.m
Last active Jul 24, 2021
Minimal C GLFW Metal example
View glfw-metal-example.m
//
// cc glfw-metal-example.m -lGLFW -framework AppKit -framework Metal -framework QuartzCore
//
#define GLFW_INCLUDE_NONE
#define GLFW_EXPOSE_NATIVE_COCOA
#include <GLFW/glfw3.h>
#include <GLFW/glfw3native.h>
#import <Metal/Metal.h>
#import <QuartzCore/CAMetalLayer.h>
@jrasanen
jrasanen / s3-individual-bucket.json
Created Oct 8, 2015
How to give permission to an individual S3 bucket (IAM policy)
View s3-individual-bucket.json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1442911835000",
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": [
@JeffBelback
JeffBelback / docker-destroy-all.sh
Last active Jun 29, 2021
Destroy all Docker Containers and Images
View docker-destroy-all.sh
#!/bin/bash
# Stop all containers
containers=`docker ps -a -q`
if [ -n "$containers" ] ; then
docker stop $containers
fi
# Delete all containers
containers=`docker ps -a -q`
if [ -n "$containers" ]; then
docker rm -f -v $containers
@voter101
voter101 / Gulpfile.js
Last active Jun 20, 2019
Gulpfile for Rails application with replaced Sprockets with Gulp
View Gulpfile.js
'use strict'
var gulp, sass, babelify, browserify, watchify, source, util;
gulp = require('gulp');
sass = require('gulp-sass');
babelify = require('babelify')
browserify = require('browserify');
watchify = require('watchify');
source = require('vinyl-source-stream');
View paypal_subscription_ext.rb
module PayPal::SDK
module REST
module DataTypes
Payer.class_eval do
object_of :merchant_id, String
end
class ChargeModel < Base
object_of :id, String
object_of :type, String
@Kartones
Kartones / postgres-cheatsheet.md
Last active Jul 24, 2021
PostgreSQL command line cheatsheet
View postgres-cheatsheet.md

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@simonista
simonista / .vimrc
Last active Jul 19, 2021
A basic .vimrc file that will serve as a good template on which to build.
View .vimrc
" Don't try to be vi compatible
set nocompatible
" Helps force plugins to load correctly when it is turned back on below
filetype off
" TODO: Load plugins here (pathogen or vundle)
" Turn on syntax highlighting
syntax on
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active Jul 22, 2021
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!
View whiteboardCleaner.md

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results