Skip to content

Instantly share code, notes, and snippets.

@marcelloinfoweb
marcelloinfoweb / index.html
Last active October 17, 2017 14:55
Tooltip Pure CSS
<!-- normally this stuff would be on the html element -->
<!--[if lt IE 7]> <div class="ie ie6 lte9 lte8 lte7"> <![endif]-->
<!--[if IE 7]> <div class="ie ie7 lte9 lte8 lte7"> <![endif]-->
<!--[if IE 8]> <div class="ie ie8 lte9 lte8"> <![endif]-->
<!--[if IE 9]> <div class="ie ie9 lte9"> <![endif]-->
<!--[if gt IE 9]> <div> <![endif]-->
<!--[if !IE]><!--> <!--<![endif]-->
<!DOCTYPE html>
<html>
@jberkus
jberkus / gist:e4cadd6b8877c3bc59c8
Created September 19, 2014 00:36
Duplicate Index Query #1: Exact Duplicates
-- check for exact matches
WITH index_cols_ord as (
SELECT attrelid, attnum, attname
FROM pg_attribute
JOIN pg_index ON indexrelid = attrelid
WHERE indkey[0] > 0
ORDER BY attrelid, attnum
),
index_col_list AS (
SELECT attrelid,
@staltz
staltz / introrx.md
Last active August 6, 2026 06:30
The introduction to Reactive Programming you've been missing
@progrium
progrium / consulkv
Created June 4, 2014 22:21
Consul KV client, depends on jq
#!/bin/bash
CONSUL="localhost:8500"
main() {
case "$1" in
info)
curl -s "$CONSUL/v1/kv/$2" | jq -r .[]
;;
get)
@emad-elsaid
emad-elsaid / working-time.rb
Created March 31, 2014 13:02
Track your computer open/shutdown times this is a very simple script, i created to track when did i open and closes my computer, on the long run, i can read these data and analyse it to see detect my usage patterns and how to improve my computer usage for a better work/life balance. this script uses simple text file as log file, it write the eve…
#!/usr/bin/env ruby
# Author : Emad Elsaid (https://github.com/blazeeboy)
FILENAME = 'db.txt'
OPEN, CLOSE = 1 , 0
file = File.open(FILENAME, 'a')
file.write "#{OPEN} : #{Time.new}\n"
file.flush
begin
@callhub
callhub / distributed_rate_limiting.py
Created February 3, 2014 08:41
Distributed rate limiting put together
script = "\
local current, expected, cur_val, callcount, maxcps \
current = redis.call('GET', KEYS[1]) \
callcount = tonumber(ARGV[1]) \
maxcps = tonumber(ARGV[2]) \
cur_val = 0 \
if current then \
cur_val = tonumber(current) \
end \
expected = cur_val + callcount \
@branneman
branneman / better-nodejs-require-paths.md
Last active July 25, 2026 13:41
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@fritzy
fritzy / getmsgpackasjson.lua
Created November 6, 2013 17:35
Redis scripts to set JSON in, store as MSGPack, and get JSON out.
--EVAL 'this script' 1 some-key
local key = KEYS[1];
local value = redis.call('GET', key);
local jvalue = cjson.encode(cmsgpack.unpack(value));
return jvalue;
@widged
widged / d3lib.md
Created October 4, 2013 03:29
d3 libraries

chartFactory

/affini-tech/ChartFactory

Based on D3.JS and Dimple, ChartFactory provide the ability to build quickly D3.JS charts without coding any lines of javascript. Just define your dashboard in a JSON and voila !

charts: [
        {id:'chart1',
         width:800,height:250,

xAxis:{type:'Category',field: "Month",orderRule:'Date'},

@plentz
plentz / nginx.conf
Last active July 23, 2026 11:59
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048