| Models | Examples |
|---|---|
| Display ads | Yahoo! |
| Search ads |
| function WindowController () { | |
| this.id = Math.random(); | |
| this.isMaster = false; | |
| this.others = {}; | |
| window.addEventListener( 'storage', this, false ); | |
| window.addEventListener( 'unload', this, false ); | |
| this.broadcast( 'hello' ); |
Since this is on Hacker News and reddit...
- No, I don't distribute my résumé like this. A friend of mine made a joke about me being the kind of person who would do this, so I did (the link on that page was added later). My actual résumé is a good bit crazier.
- I apologize for the use of
_tin my types. I spend a lot of time at a level where I can do that; "reserved for system libraries? I am the system libraries". - Since people kept complaining, I've fixed the assignments of string literals to non-const
char *s. - My use of
type * name, however, is entirely intentional. - If you're using an older compiler, you might have trouble with the anonymous unions and the designated initializers - I think gcc 4.4 requires some extra braces to get them working together. Anything reasonably recent should work fine. Clang and gcc (newer than 4.4, at le
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
| GNU GENERAL PUBLIC LICENSE | |
| Version 2, June 1991 | |
| Copyright (C) 1989, 1991 Free Software Foundation, Inc., | |
| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
| Everyone is permitted to copy and distribute verbatim copies | |
| of this license document, but changing it is not allowed. | |
| Preamble |
| var cluster = require('cluster'); | |
| var http = require('http'); | |
| var numCPUs = require('os').cpus().length; | |
| if (cluster.isMaster) { | |
| // Fork workers. | |
| for (var i = 0; i < numCPUs; i++) { | |
| cluster.fork(); | |
| } | |
| cluster.on('exit', function(worker, code, signal) { |
Author: Ben Brady Licensed: MIT
Allows selected elements to be changed (shown/hidden or callback) based on a set of field validation rules.
This is useful for large forms where you may want to hide/disable various fieldsets which are relevant only if a particular input element is selected/checked.
I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.
If you want to roll up all of these into a single jQuery plugin check out Sharrre
Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.
| # Hacky random image thumbnailer. | |
| # by Peter Sobot, April 21, 2012 | |
| # Based heavily on code by Michael Macias | |
| # (https://gist.github.com/a54cd41137b678935c91) | |
| require 'rmagick' | |
| images = Dir.glob(ARGV[0] ? ARGV[0] | |
| : '-default-input-paths-') | |
| output_dir = (ARGV[1] ? ARGV[1] |
| """Simple example showing why using super(self.__class__, self) is a BAD IDEA (tm)""" | |
| class A(object): | |
| def x(self): | |
| print "A.x" | |
| class B(A): | |
| def x(self): | |
| print "B.x" | |
| super(B, self).x() |