Skip to content

Instantly share code, notes, and snippets.

@sventech
sventech / simplecart_parser.clj
Last active June 24, 2016 20:55
Clojure parser for SimpleCart(js) form POST/GET
(ns webstore.simplecart_parser
(:require [clojure.string :as string]))
;; see github.com/sventech/simplecart-js for tax calculation improvement fork
(def input-params
{"item_quantity_1" "1",
"itemCount" "2",
"item_price_1" "9.99",
"store_name" "Online Store",
"item_name_1" "Awesome Product - MP3",
@eduardocardoso
eduardocardoso / gist:82a629882ddb02ab3677
Last active April 3, 2023 08:23
Script to delete exited containers and untagged/unused images from docker
#!/bin/bash
set -o errexit
echo "Removing exited docker containers..."
docker ps -a -f status=exited -q | xargs -r docker rm -v
echo "Removing dangling images..."
docker images --no-trunc -q -f dangling=true | xargs -r docker rmi
@gregsh
gregsh / - IDE Scripting.md
Last active April 18, 2025 16:06
IDE Scripting

Here are my attempts to script an IntelliJ-based IDE using javax.script.* API (ex-JSR-223).

The list of available scripting languages and engines:

  1. Groovy - built-in, via Groovy jars and <app>/lib/groovy-jsr223-xxx.jar
  2. JavaScript (Nashorn) - built-in, via Java Runtime <app>/jbr/... (deprecated and will be removed soon)
  3. JavaScript (GraalJS) - https://plugins.jetbrains.com/plugin/12548-intellij-scripting-javascript
  4. JPython - https://plugins.jetbrains.com/plugin/12471-intellij-scripting-python
  5. JRuby - https://plugins.jetbrains.com/plugin/12549-intellij-scripting-ruby
  6. Clojure - https://plugins.jetbrains.com/plugin/12469-intellij-scripting-clojure
@visamz
visamz / baciuzzi_queue.conf
Last active March 27, 2020 06:44
Beanstalkd and Supervisor Config. For CentOS, a modified /etc/init.d/beanstlkd file which creates a pid file in /var/run/beanstalkd.pid
[program:baciuzzi_queue]
directory=/data2/www/baciuzzi
command=php artisan queue:listen --tries=3
stdout_logfile=/data2/www/baciuzzi/app/storage/logs/supervisor.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stdout_capture_maxbytes=1MB
stderr_logfile=/data2/www/baciuzzi/app/storage/logs/supervisor_error.log
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
@triskell
triskell / cntlm_npm.md
Last active April 13, 2021 10:42
[Windows 7] CNTLM and NPM behind NTLM proxy

CNTLM and NPM behind NTLM proxy on Windows 7

CNTLM

  • Install CNTLM in a folder where you have full rights to run it as administrator.

  • Open cntlm.ini and fill it :

Username    YOUR_USERNAME
Domain YOUR_DOMAIN
@jburns131
jburns131 / My Custom Eclipse PDT PHP Editor Templates.md
Last active August 29, 2015 14:03
Eclipse PHP Editor DebuggingTemplates - Quick and easy code blocks that help speed up debugging time

Front Matter

Last tested using Eclipse 4.3.2 (Kepler), PDT v3.3.0

Explanation

Eclipse PDT's 'PHP Editor Templates' allow us to create custom autocompletion templates.

This is a small collection of templates I have created for personal use. These templates create code blocks that allow me to:

@ismasan
ismasan / sse.go
Last active February 27, 2025 00:15
Example SSE server in Golang
// Copyright (c) 2017 Ismael Celis
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
@6174
6174 / canvas-blur-image.js
Last active June 28, 2022 17:50
canvas image blur
/**
* Light layer on top of a canvas element to represent an image displayed
* within. Pass in a canvas element and an Image object and you'll see the
* image within the canvas element. Use the provided methods (e.g. blur) to
* manipulate it.
*
* @constructor
* @param {HTMLElement} element HTML canvas element.
* @param {Image} image Image object.
*/
@thoop
thoop / .htaccess
Last active November 13, 2024 20:20
Official prerender.io .htaccess for Apache.
# Change YOUR_TOKEN to your prerender token
# Change http://example.com (at the end of the last RewriteRule) to your website url
<IfModule mod_headers.c>
RequestHeader set X-Prerender-Token "YOUR_TOKEN"
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
@MNBuyskih
MNBuyskih / Date.getDaysInMonth.js
Created December 13, 2013 09:13
Method allow get totals days in month. Usage: var date = new Date(2013, 2, 14); alert(date.getDaysInMonth());
Date.prototype.getDaysInMonth = function () {
return (new Date(this.getFullYear(), this.getMonth() + 1, 0)).getDate();
};