Skip to content

Instantly share code, notes, and snippets.

@joshkehn
joshkehn / preload-example.css
Created February 11, 2014 19:11
CSS background image preloading without JavaScript. Includes LESS mixin.
.arrow {
background: url("../images/arrow-normal.svg") no-repeat top center;
}
.arrow:before {
background: url("../images/arrow-hover.svg");
display: none;
}
.arrow:hover {
background: url("../images/arrow-hover.svg");
}
## Ingredients
- 1-2 onions diced
- Garlic (as much as you'd like)
- Fresh tomatoes (quartered, remove skins if you like)
- Diced tomatoes (canned)
- Tomato paste (one tube / small can)
- Fresh basil
## Steps

Ingredients

  • 1-2 onions diced
  • Garlic (as much as you'd like)
  • Fresh tomatoes (quartered, remove skins if you like)
  • Diced tomatoes (canned)
  • Tomato paste (one tube / small can)
  • Fresh basil

Steps

```
big code block
```
```
big code block
```
/***************
Comes from a SO comment
@Josh K: This is a little over-the-top: $hash = sha1(sha1($password) ^ $salt);, $hash = sha1($password.$salt); would work just as well in practice (and faster). Also, the only reason I can think of to sha1(microtime()) is to constrain it to something that can fit in your column, and substr(str(microtime()), 0, 160) would work equally well (and faster), although I doubt microtime() gives a > 160 digit number anyway. Of course, you might be intentionally making it slow (so it would take more time to crack), but the performance should at least be mentioned.
Question: http://stackoverflow.com/questions/3038136/am-i-supposed-to-store-hashes-for-passwords/3038182#3038182
User: http://stackoverflow.com/users/212555/brendan-long
**************/
boolean excepted = false;
while(!excepted && (/* Condition */))
{
try
{
/* Amazing code */
}
catch(Exception e)
{
@joshkehn
joshkehn / gist:1127722
Created August 5, 2011 15:03
WebSocket - Part 6
var net = require("net"),
domains = ["*:*"];
@joshkehn
joshkehn / gist:1127737
Created August 5, 2011 15:10
WebSocket - Part 12
intervals[conn] = setInterval(
function()
{
date = new Date();
conn.send(date.toString());
}
, 1000);
}
);
@joshkehn
joshkehn / gist:1127718
Created August 5, 2011 15:02
WebSocket - Part 4
function output(str)
{
document.getElementById("log").innerHTML = str;
}