Skip to content

Instantly share code, notes, and snippets.

@jeresig
jeresig / cookiebot.js
Last active October 5, 2023 12:20
Simple bot for CookieClicker: http://orteil.dashnet.org/cookieclicker/ How to use: Paste the following into the JavaScript console in your browser and run it. To start the bot type: "CookieClicker.start();" to stop it do: "CookieClicker.stop();" (or just reload the page).
CookieClicker = {
start: function() {
this.clickInterval = setInterval(function(){
// Click the large cookie as fast as possible!
document.getElementById("bigCookie").click();
}, 1);
this.goldInterval = setInterval(function(){
// Click the golden cookie
var shimmer = document.getElementsByClassName("shimmer")[0];
@don1138
don1138 / font-stacks.css
Last active May 17, 2025 14:31
CSS Modern Font Stacks
/* Modern Font Stacks */
/* System */
font-family: system, -apple-system, ".SFNSText-Regular", "San Francisco", "Roboto", "Segoe UI", "Helvetica Neue", "Lucida Grande", sans-serif;
/* System (Bootstrap 5.2.0) */
font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
/* Times New Roman-based serif */
font-family: Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif;
@sdball
sdball / nil_what_are_you_doing_stahp.rb
Last active March 16, 2019 01:35
Sometimes Ruby is Weird
class NilWhatAreYouDoingStahp
attr_accessor :not_nil
def initialize
@not_nil = "I'm not nil! I'm a value!"
end
def wat
if not_nil.nil?
not_nil = "Ok, now I'm not nil."
@indrode
indrode / package.json
Created February 22, 2013 16:35
This is the package.json for Talker-Hubot client. See http://lamentingrobot.com/hubot-talker for more info.
{
"name": "hosted-hubot",
"version": "2.4.6",
"author": "GitHub Inc.",
"keywords": "github hubot campfire bot",
"description": "A simple helpful Robot for your Company",
"licenses": [{
"type": "MIT",
"url": "http://github.com/github/hubot/raw/master/LICENSE"
}],
@ryanblock
ryanblock / @ryan tweetbot regex.md
Created August 29, 2012 02:27
How Tweetbot and regex made my Twitter replies usable again (filed under: #wrongryan)

How Tweetbot and regex made my Twitter replies usable again

As it turns out, most normal humans are incapable of learning to use Twitter @ replies. And in case you don't follow me on Twitter: yes, my handle (@ryan) gets a lot of erroneous mentions. (The most amusing, random ones I've even taken to retweeting under the #wrongryan hashtag.)

Then Tweetbot -- and its ability to use regex as Twitter filters -- came along. Here's how the Tapbots guys and some regular expressions single-handedly made my Twitter replies usable again.

Notes and caveats

  • I'm not a regex expert. Far from it. I suck at regex, actually. If you have suggestions for improvements, please leave them below!
  • Some regex may look a little sloppy, but in actuality was written because TweetBot for Mac's regex filter support is very early, and things like repeats (expression{3,}) are buggy. So everything below should work without crashing Tweetbot for iPhone, iPad, and Mac.
  • Obvious, but not everyone should make use of every filter b
@nnieslan
nnieslan / Http-RestCommunicate.ps1
Created August 7, 2012 13:32
Powershell Http Command execution function with JSON <-> Powershell hashtable helpers. Can be used to communicate with RESTful API
<#
.SYNOPSIS
Converts a JSON string into a PowerShell hashtable using the .NET System.Web.Script.Serialization.JavaScriptSerializer
.PARAMETER json
The string of JSON to deserialize
#>
function ConvertFrom-Json
{
param(
[string] $json
@RedWolves
RedWolves / gist:2664255
Created May 12, 2012 05:06
Another implementation to @dieseltravis compare jQuery version strings gist https://gist.github.com/2662417 Demo in comments.
var jQueryVer = {
isEqual: function (test, act) {
this.version = test || this.version;
if (this.version) {
//if actual jquery version is passed in use that if not get it.
act = act || jQuery.fn.jquery;
return this._compare(act);
}
},
//Boolean value on if the actual jQuery Version is greater then the test version.
@bennadel
bennadel / trigger.htm
Created April 26, 2012 14:32
Mouse vs. Keyboard - Determining Click Initiator Using A jQuery Custom Event
<!DOCTYPE html>
<html>
<head>
<title>Determine Link Trigger Method With jQuery</title>
</head>
<body>
<h1>
Determine Link Trigger Method With jQuery
</h1>
@jpoehls
jpoehls / output.txt
Created March 26, 2012 16:48
PowerShell benchmarking function. Or, the Windows equivalent of Unix's `time` command.
PS> time { ping -n 1 google.com } -Samples 10 -Silent
..........
Avg: 62.1674ms
Min: 56.9945ms
Max: 87.9602ms
PS> time { ping -n 1 google.com } -Samples 10 -Silent -Long
..........
Avg: 00:00:00.0612480
Min: 00:00:00.0572167
@samuelcole
samuelcole / jquery.preload_background_image.js
Created March 23, 2012 21:06
A little plugin for preloading background images (for spinners 'n stuff).
(function ($) {
function background_image_url($object) {
var string = $object.css('backgroundImage'),
url_regex = /[("]([^()"]+)[")]/;
return url_regex.exec(string)[1];
}
$.fn.preload_background_image = function () {
return $(this).each(function () {
(new Image()).src = background_image_url($(this));