Skip to content

Instantly share code, notes, and snippets.

@io41
io41 / paginated_collection.js
Created February 22, 2011 10:10 — forked from zerowidth/paginated_collection.js
Pagination with Backbone.js
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
typeof(options) != 'undefined' || (options = {});
this.page = 1;
typeof(this.perPage) != 'undefined' || (this.perPage = 10);
},
fetch: function(options) {
@jeremyboggs
jeremyboggs / custom-post-type-flush-rewrite-rules.php
Created March 15, 2011 22:00
Pseudo-elegant way to flush rewrite rules after creating a custom post type.
<?php
/**
* Example for writing a WP plugin that adds a custom post type and flushes
* rewrite rules only once on initialization.
*/
/**
* On activation, we'll set an option called 'my_plugin_name_flush' to true,
* so our plugin knows, on initialization, to flush the rewrite rules.
*/
@atomize
atomize / iosCSS.html
Created March 1, 2012 07:59
iOS icon in pure CSS3 (with rando cool CSS image in background :-)
<style>
.icon {
background: #33CC00;
background-image:url(http://www.cyberdesignz.com/blog/wp-content/uploads/2009/12/CSS.png);
background-repeat:no-repeat;
background-position:center;
background-size:100%;
width: 128px;
height: 128px;
border-radius: 19px;
@DavidWells
DavidWells / add-wordpress-settings-page.php
Created January 28, 2013 05:59
WordPress :: Add Settings Page with All Fields
<?php
/*
Plugin Name: Homepage Settings for BigBang
Plugin URI: http://www.inboundnow.com/
Description: Adds additional functionality to the big bang theme.
Author: David Wells
Author URI: http://www.inboundnow.com
*/
// Specify Hooks/Filters
@TheAnonymous
TheAnonymous / Bcache Tutorial
Last active April 21, 2019 03:46
Making a SSD working as a Cache for a HDD with bcache.
There are 3 Methods for using a SSD as cache.
dm-cache, bcache,enhance-io all three should be avaliable in Kernel Version 3.10.
Performance differenceses are discussed here => http://lkml.indiana.edu/hypermail/linux/kernel/1306.1/01246.html
In this tutorial I will use bcache since dm-cache didn't worked for me.
At the moment there is only an rc5 candidate for kernel 3.10.0
How to compile it is explained below. If you have a newer kernel than 3.10 and it is bcache enabled you dont need to compile it by yourself. In this case just jump over the kernel-compile-exlanation. If your kernel is compiled with bcache support you can test with "modprobe bcache". If that doesnt throw an error it should work :)
I will link to the tutorials I used. If you found better ones please paste a link in the comments
How to compile a kernel by yourself is explained at:
=> http://bodhizazen.net/Tutorials/kernel
@plentz
plentz / nginx.conf
Last active March 14, 2025 06:00
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
@llbbl
llbbl / awesome-php.md
Last active February 5, 2025 10:14 — forked from ziadoz/awesome-php.md
Awesome PHP Libraries and Resources

Awesome PHP

A list of amazingly awesome PHP libraries, resources and shiny things.

Categories

  • Composer
  • Composer Related
  • Frameworks
  • Micro Frameworks
@shamil
shamil / mount_qcow2.md
Last active March 15, 2025 13:40
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
// Restify Server CheatSheet.
// More about the API: http://mcavage.me/node-restify/#server-api
// Install restify with npm install restify
// 1.1. Creating a Server.
// http://mcavage.me/node-restify/#Creating-a-Server
var restify = require('restify');
@lrvick
lrvick / leak-recursive.js
Last active April 10, 2018 09:08
iojs/node memory leaks when dealing with promises and infinite loops
// This leaks insane amounts of memory
var fetchCallback = function(resolve, reject) {
resolve({'some':'test'})
}
var fetch = function() {
return new Promise(fetchCallback)
}