Skip to content

Instantly share code, notes, and snippets.

View nkcmr's full-sized avatar

nick comer nkcmr

View GitHub Profile
@basuke
basuke / gen-security.php
Created April 20, 2011 10:08
Generate CakePHP configuration value for security, Security.salt and Security.cipherSeed.
<?php
$salt = genrandom(40);
$seed = genrandom(29, "0123456789");
echo "\tConfigure::write('Security.salt', '$salt');\n";
echo "\tConfigure::write('Security.cipherSeed', '$seed');\n";
function genrandom($len, $salt = null) {
if (empty($salt)) {
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 3, 2024 19:09
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@jayj
jayj / flexbox.less
Last active November 20, 2023 04:51
CSS3 Flexbox - LESS Mixins
// --------------------------------------------------
// Flexbox LESS mixins
// The spec: http://www.w3.org/TR/css3-flexbox
// --------------------------------------------------
// Flexbox display
// flex or inline-flex
.flex-display(@display: flex) {
display: ~"-webkit-@{display}";
display: ~"-ms-@{display}box"; // IE10 uses -ms-flexbox
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active April 30, 2024 04:42
A badass list of frontend development resources I collected over time.
@ogrrd
ogrrd / dnsmasq OS X.md
Last active May 3, 2024 08:33
Setup dnsmasq on OS X

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.

Requirements

Install

@brianfryer
brianfryer / gist:5987888
Created July 12, 2013 21:12
cornsole.log()
var cornsole = {
log: function(txt) {
var cornhole = atob('ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC4tLS0tLS0tLS0tLS0tLg0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyAgICAgICAgICAgICAgIFwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyAuLS0tLS0uICAgICAgICAgXA0KSSBhbSB0aGUgR3JlYXQgQ29ybmhvbGlvISEgICAgICAgICB8LyAtLWAtYC1cICAgICAgICAgXA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB8ICAgICAgICAgXCAgICAgICAgfA0KSSBuZWVkIFRQIGZvciBteSBidW5naG9sZSEhICAgICAgICAgfCAgIF8tLSAgIFwgICAgICAgfA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgX3wgPS0uICAgICB8ICAgICAgfA0KQ29tZSBvdXQgd2l0aCB5b3VyIHBhbnRzIGRvd24hICAgICAgb3wvby8gICAgICB8ICAgICAgfA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLyAgfiAgICAgICB8ICAgICAgfA0KQVJFIFlPVSBUSFJFQVRFTklORyBNRT8/ICAgICAgICAgIChfX19fQCkgIF9fXyB8ICAgICAgfA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBfPT09fn5+LmB8ICAgICAgfA0KT2guIGhlaC1oZWguICBTb3JyeSBhYm91dCB0aGF0LiAgIF9fX19fX18uLS1+ICB8ICAgICAgfA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcX19fX19
@rxaviers
rxaviers / gist:7360908
Last active May 4, 2024 00:48
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@chanks
chanks / gist:7585810
Last active February 29, 2024 03:50
Turning PostgreSQL into a queue serving 10,000 jobs per second

Turning PostgreSQL into a queue serving 10,000 jobs per second

RDBMS-based job queues have been criticized recently for being unable to handle heavy loads. And they deserve it, to some extent, because the queries used to safely lock a job have been pretty hairy. SELECT FOR UPDATE followed by an UPDATE works fine at first, but then you add more workers, and each is trying to SELECT FOR UPDATE the same row (and maybe throwing NOWAIT in there, then catching the errors and retrying), and things slow down.

On top of that, they have to actually update the row to mark it as locked, so the rest of your workers are sitting there waiting while one of them propagates its lock to disk (and the disks of however many servers you're replicating to). QueueClassic got some mileage out of the novel idea of randomly picking a row near the front of the queue to lock, but I can't still seem to get more than an an extra few hundred jobs per second out of it under heavy load.

So, many developers have started going straight t

@iamnewton
iamnewton / bash-colors.md
Last active May 2, 2024 22:42
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple