Skip to content

Instantly share code, notes, and snippets.

@curtis
curtis / imagemagick-heroku-after.txt
Last active September 21, 2021 15:55
Imagemagick limits after setting Heroku config
$ heroku config:set MAGICK_MAP_LIMIT=32MiB
Setting MAGICK_MAP_LIMIT and restarting ⬢ radiant-waters-37422... done, v46
MAGICK_MAP_LIMIT: 32MiB
$ heroku config:set MAGICK_MEMORY_LIMIT=16MiB
Setting MAGICK_MEMORY_LIMIT and restarting ⬢ radiant-waters-37422... done, v47
MAGICK_MEMORY_LIMIT: 16MiB
$ heroku run identify -list resource
Running identify -list resource on ⬢ radiant-waters-37422... up, run.5905 (Hobby)
  • 🎨 when improving the format/structure of the code
  • 🚀 when improving performance
  • ✏️ when writing docs
  • 💡 new idea
  • 🚧 work in progress
  • ➕ when adding feature
  • ➖ when removing feature
  • 🔈 when adding logging
  • 🔇 when reducing logging
  • 🐛 when fixing a bug
@mcoms
mcoms / 7.rb
Last active January 1, 2016 23:59
Where's the best place to buy 7?
require 'nokogiri'
require 'open-uri'
require 'json'
doc = Nokogiri::HTML(open('http://www.mysupermarket.co.uk/asda-compare-prices/Spirits/Havana_Club_Rum_Anejo_7_Year_Old_700ml.html'))
prices = doc.css('#PriceComparison .StoreDiv').map {|c| { name: c.css('.ImgSpan img').first['alt'], cheapest: c['class'].include?('Cheapest'), price: c.css('.Price>span.priceClass, .Price>span.Offer').text.strip } }
# => [{:name=>"ASDA", :cheapest=>true, :price=>"£18.00"},
# {:name=>"Tesco", :cheapest=>false, :price=>"£23.30"},
# {:name=>"Ocado", :cheapest=>false, :price=>"£23.30"},
@xeoncross
xeoncross / ajax.js
Last active August 3, 2023 06:06
Simple, cross-browser Javascript POST/GET xhr request object. Supports request data and proper AJAX headers.
/**
* IE 5.5+, Firefox, Opera, Chrome, Safari XHR object
*
* @param string url
* @param object callback
* @param mixed data
* @param null x
*/
function ajax(url, callback, data, x) {
try {

Generating a self signed SSL certificate

Creates a resulting server.crt certificate and server.key private key.

Method one

  • $ openssl genrsa -des3 -out server.key.tmp 1024
    • Note: Enter a dummy pass pharse (e.g. 1234) and remember it
  • $ openssl rsa -in server.key.tmp -out server.key
    • Enter dummy pass pharse from previous step
  • Generate certificate request file (CSR)
  • $ openssl req -new -key server.key -out server.csr
@tabo
tabo / EVERYTHING.sh
Created March 18, 2013 20:56
Helper scripts for my jenkins server that spawn databases in RAM
#!/bin/sh
. ramdisk.sh
. mysql-spawn.sh
. postgres-spawn.sh
. mysql-start.sh
. postgres-start.sh
sleep 1
. createdbs.sh
. jenkins-start.sh
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active June 5, 2024 22:16
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@malarkey
malarkey / Contract Killer 3.md
Last active July 5, 2024 08:43
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@jasoares
jasoares / cucumber_init.sh
Created May 4, 2012 17:41
Cucumber init script for non rails applications
#!/bin/bash
# Create the directory structure
mkdir -p features/step_definitions
mkdir -p features/support
# Create a placeholder for the step_definitions folder
touch features/step_definitions/"$(basename `pwd`)_steps.rb"
# Create the environment file
@elliottkember
elliottkember / spotify.applescript
Created February 22, 2012 12:45
Spotify Applescript
property baseURL : "http://statusboard.dev/song?"
if application "Spotify" is running then
tell application "Spotify"
set theTrack to name of the current track
set theArtist to artist of the current track
set theAlbum to album of the current track
set theurl to spotify url of the current track
try
do shell script "/usr/local/bin/wget --delete-after \"" & baseURL & "&t=" & theTrack & "&a=" & theArtist & "&al=" & theAlbum & "\""