Skip to content

Instantly share code, notes, and snippets.

HTML_TAG_REPLACEMENTS = {
'br' => "\n",
}
HTML_QUOTE_REPLACEMENTS = {
'quot' => '"',
'amp' => '&',
}
def strip_html(str, tag = HTML_TAG_REPLACEMENTS, quot = HTML_QUOTE_REPLACEMENTS)
str.gsub %r{
@gittmaan
gittmaan / rbenv-install-system-wide.sh
Created July 23, 2012 22:54 — forked from v1nc3ntlaw/rbenv-install-system-wide.sh
rbenv install ruby 1.9.3-p194 on Ubuntu
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential git-core curl libssl-dev \
libreadline6 libreadline6-dev \
zlib1g zlib1g-dev \
libmysqlclient-dev \
libcurl4-openssl-dev \
libxslt-dev libxml2-dev
@gittmaan
gittmaan / gist:0cf16fb0a1b3bb15ea3c
Created December 1, 2015 03:58 — forked from progrium/gist:5734609
Let unprivileged processes easily restart/reload Nginx without sudo or setuid hacks
# run this as root
while [ 1 ]; do echo | nc -l -U /tmp/reload_nginx && /etc/init.d/nginx reload; done
# or as an upstart job
script
echo | nc -l -U /tmp/reload_nginx && /etc/init.d/nginx reload
end script
respawn
# now any process can run this or do the equivalent with sockets to trigger reload
@gittmaan
gittmaan / supervisord
Created December 5, 2015 00:27
centos6 supervisord init script
#!/bin/sh
#
# /etc/rc.d/init.d/supervisord
#
# Supervisor is a client/server system that
# allows its users to monitor and control a
# number of processes on UNIX-like operating
# systems.
#
# chkconfig: - 64 36
@gittmaan
gittmaan / gist:663e4403f69e531aac130ea5e724871e
Created April 17, 2017 04:52 — forked from aaronshaf/bookmarklet-expanded.js
Copy text from Amazon's Cloud Reader
// Useful for students in need of block quotes for their paper, etc.
// Execute the line in your JavaScript console
new_window=window.open();new_window.document.body.innerHTML = $('iframe').contents().find('iframe').contents().find('body').get(1).innerHTML;
javascript:new_window=window.open();new_window.document.body.innerHTML = $('iframe').contents().find('iframe').contents().find('body').get(1).innerHTML;
@gittmaan
gittmaan / cheap_downloader.rb
Created April 6, 2018 02:02 — forked from orlando/cheap_downloader.rb
destroyallsoftware cheap screencast downloader
#!/usr/bin/ruby
require 'rss'
#this assumes you have a cookies.txt with destroyallsoftware.com cookies... later ill add a signin method..
class Link
attr_accessor :link,:title,:date
def initialize(link,title,date)
@link = link

Array<T>

Legend:

  • ✏️ method changes this.
  • 🔒 method does not change this.

Array<T>.prototype.*:

  • concat(...items: Array): T[] 🔒 ES3
@gittmaan
gittmaan / snippet_of_vkbeautify.2.0.js
Created October 17, 2018 20:48 — forked from njohnson7/snippet_of_vkbeautify.2.0.js
How to change indentation of Postman HTML Pretty view to 2 spaces instead of 4
function vkbeautify(){ // line 83 of vkbeautify.2.0.js
// change the string below to 2 spaces instead of 4:
this.step = ' '; // 4 spaces
this.shift = createShiftArr(this.step);
};
@gittmaan
gittmaan / History|-102811e2|entries.json
Last active May 4, 2023 16:28 — forked from koulmomo/sublime_text_2_perfect_key_bindings
Perfect Sublime Text 2 Key Bindings. Tab to skip out of brackets, braces, parentheses, and quotes/quotations but still be able to indent
{"version":1,"resource":"file:///Users/girishp/projects/tryambake/code/development/nakshatra/src/scripts/ayanmasa.js","entries":[{"id":"vkpo.js","timestamp":1661729634292},{"id":"uGhx.js","timestamp":1661729706107},{"id":"myRH.js","timestamp":1661731472046},{"id":"KAEl.js","timestamp":1661731676002},{"id":"ux1j.js","timestamp":1661731803556},{"id":"rz3u.js","timestamp":1661731856633},{"id":"HhFw.js","timestamp":1661732882740},{"id":"EvL5.js","timestamp":1661732967666},{"id":"mr5z.js","timestamp":1661732999705},{"id":"yhuD.js","timestamp":1661733154400},{"id":"J40H.js","timestamp":1661733174258},{"id":"EwrC.js","timestamp":1661733208740},{"id":"OxJ1.js","timestamp":1661733245767},{"id":"8BSV.js","timestamp":1661733324748},{"id":"8Mvf.js","timestamp":1661733405253},{"id":"NeuX.js","timestamp":1661733416013},{"id":"bCuI.js","timestamp":1661733529128},{"id":"3W8r.js","timestamp":1661733575747},{"id":"E78j.js","timestamp":1661733590158},{"id":"z6NS.js","source":"undoRedo.source","timestamp":1661733600578},{"id":"y
@gittmaan
gittmaan / node-typescript-esm.md
Created November 21, 2023 18:45 — forked from khalidx/node-typescript-esm.md
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json