Skip to content

Instantly share code, notes, and snippets.

@dobesv
dobesv / test.html
Created September 17, 2011 14:02
Some whitespace relating testing with jadejs
<div class="test"><!-- Adding text using | results in a newline AFTER (not before) each line-->foo
bar
baz
</div>
<div class="test"><!--I thought I could use extra | lines to insert additional whitespace but
this currently outputs | characters into the result.
-->|
foo
|
@frangio
frangio / gist:985684
Created May 22, 2011 17:22
Vim - Don't create swap files for files in the Dropbox folder (useful for folders shared with Windows people)
autocmd BufNewFile,BufRead *
\ if expand('%:~') =~ '^\~/Dropbox' |
\ set noswapfile |
\ else |
\ set swapfile |
\ endif
@giavac
giavac / secure_ws.js
Created February 6, 2015 17:49
Decorate the WebSocket module with an HTTPS server
var ws_cfg = {
ssl: true,
port: 8080,
ssl_key: '/path/to/ssl.key',
ssl_cert: '/path/to/ssl.crt'
};
var processRequest = function(req, res) {
console.log("Request received.")
};
@zakkak
zakkak / disable_panel_shadow.sh
Created April 11, 2017 08:55 — forked from alibitek/disable_panel_shadow.sh
Disable KDE panel shadow. Script to be placed in ~/.kde/Autostart/disable_panel_shadow.sh https://forum.kde.org/viewtopic.php?f=285&t=121592
for WID in `xwininfo -root -tree | sed '/"plasma-desktop": ("Plasma" "Plasma")/!d; s/^ *\([^ ]*\) .*/\1/g'`; do
xprop -id $WID -remove _KDE_NET_WM_SHADOW
done
# or
for WID in `xwininfo -root -tree | sed '/"Plasma": ("plasmashell" "plasmashell")/!d; s/^ *\([^ ]*\) .*/\1/g'`; do
xprop -id $WID -remove _KDE_NET_WM_SHADOW
done
@RickWong
RickWong / react.html
Last active April 20, 2021 15:48
Write React apps in 1 HTML file.
<html>
<body>
<div id="react-root"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-with-addons.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.5.2/redux.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.7.7/babel.min.js"></script>
<script id="react-app" type="text/template">
const App = ({name}) => {
@joeytwiddle
joeytwiddle / gist:6129676
Last active December 20, 2022 15:25
Deep population helper for mongoose
// Example usage:
// deepPopulate(blogPost, "comments comments._creator comments._creator.blogposts", {sort:{title:-1}}, callback);
// Note that the options get passed at *every* level!
// Also note that you must populate the shallower documents before the deeper ones.
function deepPopulate(doc, pathListString, options, callback) {
var listOfPathsToPopulate = pathListString.split(" ");
function doNext() {
if (listOfPathsToPopulate.length == 0) {
// Now all the things underneath the original doc should be populated. Thanks mongoose!
callback(null,doc);
@shvchk
shvchk / lean-nativefier.sh
Last active June 5, 2023 23:43
nativefier wrapper removing bundled electron to use shared / system-wide elecron
#! /usr/bin/env bash
# To use apps created with this script you will need Electron installed e.g. with npm install -g electron
set -e
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Please specify app name and URL. E.g. $0 Example https://example.com"
exit 1
fi
@nobitagit
nobitagit / iterm2.md
Last active August 24, 2023 12:16
iterm2 cheatsheet

This gist has been moved to its own Github repo, so it's easier to contribute with additions and corrections. Please open a PR there if you see any mistake, I don't track comments on here as there's no notification system for gists AFAIK. Thanks.

Tabs and Windows

Function Shortcut
Previous Tab + Left Arrow
Next Tab + Right Arrow
Go to Tab + Number
@adilbaig
adilbaig / git-updater
Last active November 30, 2023 12:49
A bash script to update your git repos in the background. It also pops up a user notification when a repo is synced
#!/bin/bash
# This is required for `notify-send` to work from within a cron.
# http://askubuntu.com/questions/298608/notify-send-doesnt-work-from-crontab/346580#346580
eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME gnome-session)/environ)";
# syncAndWink
#
# Syncs all remotely-tracked branches on a git repo passed as first argument ($1). It also pulls any new branches
# and tags attached to the repo.
@luizcarraro
luizcarraro / open-external-link.js
Created July 27, 2017 11:37
ELECTRON: Open link in external default OS browser