CodeCollector.net

The best way to share and discover code snippets!

Code Collector Pro Header Image

Collections

Collections are groups similarly related code snippet groups. For example our first two collections are for Rapidweaver and Wordpress with more coming soon. Collections are based 100% on user demand, by submitting more snippets for a given topic we are likely to make a collection around it.

Share to everyone

Share your discovered snippets or snippets from your library through any social network (Twitter, Facebook, Google+, you name it).

Access from anywhere

Using our responsively designed website, you can access your snippets from anywhere and pretty much any device (mobile, computer, tablet, web), all you need is a internet connection.

Tightly Integrated

CodeCollector.net has tight integration with Code Collector Pro, the Mac based Snippet manager. You can easily share and backup your snippet collection. Once they are in the cloud they are accessible from anywhere with a connection and browser. More Info »



Latest Snippets

style.css - Snippet icon style.css
  1. /* ---------------------
  2. Page Styles
  3. ------------------------ */
  4.  
  5. body {
  6. font-family: 'Alegreya', Georgia, serif;
  7. font-weight: normal;
  8. color: #333;
  9. font-size: 1.25em;
  10. background: #f9f9f9;
  11. }
  12.  
  13. .container {
  14. max-width: 37.5em;
  15. margin: 0 auto;
  16. padding: 4.2em 0;
  17. }
  18.  
  19. p {
  20. font-size: 1em;
  21. line-height: 1.6;
  22. margin: 0;
  23. }
  24.  
  25. .bold {
  26. font-weight: bold;
  27. }
  28.  
  29. .italic {
  30. font-style: italic;
  31. }
  32.  
  33. /*p + p {
  34.  
See the complete snippet
Language: CSS
Tags: No Tags
Submitted By: durul
index.html - Snippet icon index.html
  1. <!DOCTYPE html>
  2. <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
  3. <meta name="viewport" content="width=device-width, minimum-scale=1.0">
  4. <title>Typographic Hierarchy - Weight and Style</title>
  5. <link rel="stylesheet" href="style.css">
  6. <link href='http://fonts.googleapis.com/css?family=Alegreya:400italic,700italic,400,700' rel='stylesheet' type='text/css'>
  7. </head>
See the complete snippet
Language: HTML
Tags: No Tags
Submitted By: durul
Jquery Prefectching - Snippet icon Jquery Prefectching
  1. // create an object named "app" which we can define methods on
  2. var app = {
  3. // returns an array of each url to prefetch
  4. prefetchLinks: function(){
  5. // returns an array of each a.prefetch link's href
  6. var hrefs = $("a.prefetch").map(function(index, domElement){
  7. return $(this).attr("href");
  8. });
  9. // returns the array of hrefs without duplicates
  10.  
See the complete snippet
Language: Other
Tags: No Tags
Submitted By: robert7811
Rspec - stubbing - Snippet icon Rspec - stubbing
  1. allow(content_order).to receive(:content).and_return(content)
See the complete snippet
Language: Other
Tags: No Tags
Submitted By: jacinda
Rspec - double - Snippet icon Rspec - double
  1. double(:sku => double(:orderable? => false))
See the complete snippet
Language: Ruby on Rails
Tags: No Tags
Submitted By: jacinda
Language: Ruby on Rails
Tags: No Tags
Submitted By: jacinda
Rspec - adding params - Snippet icon Rspec - adding params
  1. require 'spec_helper'
  2.  
  3. describe LocationsController do
  4. let(:lc) { LocationsController.new() }
  5.  
  6. it "finds proper location when location_id is passed" do
  7. fake_params = {:location_id => "5" }
  8. lc.params = fake_params
  9. end
  10.  
  11. end
See the complete snippet
Language: Ruby on Rails
Tags: No Tags
Submitted By: jacinda
Factory Girl - factories w/in factories - Snippet icon Factory Girl - factories w/in factories
  1. FactoryGirl.define do
  2.  
  3. factory :filter do
  4. sequence(:name) { |n| "Filter name #{n}" }
  5. conditions "(locations.name = 'sample-condition')"
  6.  
  7. factory :locationfilter do
  8. type 'LocationFilter'
  9. end
  10.  
  11. factory :contentfilter do
  12. type 'ContentFilter'
  13. end
  14. end
  15.  
  16. end
  17.  
See the complete snippet
Language: Ruby on Rails
Tags: No Tags
Submitted By: jacinda
Rspec Unit/Model Test - Stubbing and Mocking long example - Snippet icon Rspec Unit/Model Test - Stubbing and Mocking long example
  1. require 'spec_helper'
  2.  
  3. describe ContentOrder do
  4.  
  5. it 'should create valid factories' do
  6. container_type = FactoryGirl.build(:container_type)
  7. expect(FactoryGirl.build(:content, :container_type => container_type)).to be_valid
  8.  
  9. fixture = FactoryGirl.build(:fixture)
  10. content = FactoryGirl.build(:content)
  11. content_order = FactoryGirl.build(:content_order, :quantity => 1)
  12. allow(co
See the complete snippet
Language: Ruby on Rails
Tags: No Tags
Submitted By: jacinda
Rspec Unit/Model Test - simple - Snippet icon Rspec Unit/Model Test - simple
  1. require 'spec_helper'
  2.  
  3. describe Filter do
  4.  
  5. it 'should create valid LocationFilter factories' do
  6. location_filter = FactoryGirl.build(:filter, :type => 'LocationFilter')
  7. expect(location_filter).to be_valid
  8. end
  9.  
  10. context 'for new/edited location filters' do
  11.  
  12. let(:new_filter) { FactoryGirl.build(:filter,
  13. :conditions => "(locations.name = 'sample-condition'
See the complete snippet
Language: Ruby on Rails
Tags: No Tags
Submitted By: jacinda



Most Popular Snippets

Magento Core: Add ShopZilla tracking codes - Snippet icon Magento Core: Add ShopZilla tracking codes
  1. ---------------
  2. Open:
  3. ---------------
  4.  
  5. /app/design/frontend/base/default/template/checkout/success.phtml
  6.  
  7.  
  8. ---------------
  9. Add To Bottom Of Page:
  10. ---------------
  11.  
  12. <!-- Shopzilla Tracking -->
  13. <!-- Start -->
  14.  
  15. <?php
  16. //Get Order Number & Order Total
  17. $order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
  18. $amount = number_format($order-
See the complete snippet
Language: Other
Tags: Core CE 1.6
Submitted By: Tamburra
Add/remove contact info fields - Snippet icon Add/remove contact info fields
Wordpress Users Custom Fields
  1. User profiles in WordPress by default have these fields for Contact Info by default: E-mail, Website, AIM, Yahoo IM, Jabber / Google Talk. You can remove those and add new ones as you wish, like in this example code for your functions.php file in your theme:
  2.  
  3. <?php
  4. function wptuts_contact_methods( $contactmethods ) {
  5.  
  6. // Remove we what we don't want
  7. unset( $contactmethods[ 'aim' ] );
See the complete snippet
Language: PHP
Tags: Wordpress
Submitted By: wpthemesbuilder
diffEigen.R - Snippet icon diffEigen.R
Differentiation of generalized eigenvalues and singular values of matrices depending on parameters.
  1. #
  2. # diffEigen package
  3. # Copyright (C) 2007 Jan de Leeuw <[email protected]>
  4. # UCLA Department of Statistics, Box 951554, Los Angeles, CA 90095-1554
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2 of the License, or
  9. # (at your option)
See the complete snippet
Language: R
Tags: Eigenvalues Singular Values Differentiation
Submitted By: deleeuw
Method Replacement (swizzle) - Snippet icon Method Replacement (swizzle)
  1. /* http://developer.apple.com/samplecode/MethodReplacement/listing3.html */
  2.  
  3. #import <AppKit/AppKit.h>
  4. #import <objc/runtime.h>
  5.  
  6. @interface NSWindow (TestMethodReplacement)
  7. - (void)TestMethodReplacement_sendEvent:(NSEvent *)event;
  8. @end
  9.  
  10. @implementation NSWindow (TestMethodReplacement)
  11.  
  12. + (void)load {
  13. if (self == [NSWindow class]) {
  14. // Swap the implementations of -[NSWindow sendEvent:]
See the complete snippet
Language: Objective-C
Tags: No Tags
Submitted By: powidl
serial-box-mac-crack-serial-keygen-rapidshare-download.html - Snippet icon serial-box-mac-crack-serial-keygen-rapidshare-download.html
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>Serial Box Mac Full Download Crack Serial Keygen Warez Free</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  6. <meta http-equiv="imagetoolbar" content="no" />
  7. <meta name="Robots" content="index
See the complete snippet
Language: Other
Tags: No Tags
Submitted By: reddish
CRIBBS -- Cron Rsync Incremental Backup Bash Script - Snippet icon CRIBBS -- Cron Rsync Incremental Backup Bash Script
  1. #!/bin/bash
  2.  
  3. #######################################################
  4. # CRIBBS -- Cron Rsync Incremental Backup Bash Script #
  5. # AUTHOR: Adam Merrifield <http://adam.merrifield.ca> #
  6. # (and countless sources from the web) #
  7. # DATE: 05-26-11 23:17 #
  8. # VERSION: 1.0.0 #
  9. #######################################################
  10.  
  11. ##
See the complete snippet
Language: bash
Tags: cron rsync incremental backup bash cribbs
Submitted By: seyDoggy
Registration UH Username - Snippet icon Registration UH Username
  1. <?php
  2.  
  3. if (!isset($_POST['submit'])) {
  4.  
  5. echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
  6.  
  7. <html>
  8. <head>
  9. <title>UH Username Request Form</title>
  10.  
  11. <BODY>
  12. <div class=\"title\">
  13. University of Hawai'i Information Technology Services <BR>
  14. Department UH Username Request Form<BR><BR>
  15. </div>
  16.  
  17. <form action=\"/registration.php\" method = \"POST\">
  18.  
  19. <LABEL for=\"Name\">Name: </LABEL>
  20. <I
See the complete snippet
Language: PHP
Tags: No Tags
Submitted By: Bassglider
Tibco CM Sender - Snippet icon Tibco CM Sender
  1.  
  2. /*
  3.  * Copyright (c) 1998-2002 TIBCO Software Inc.
  4.  * All rights reserved.
  5.  * TIB/Rendezvous is protected under US Patent No. 5,187,787.
  6.  * For more information, please contact:
  7.  * TIBCO Software Inc., Palo Alto, California, USA
  8.  *
  9.  * $Id: cmsender.java 12313 2005-11-23 18:08:58Z dleshc $
  10.  */
  11.  
  12.  
  13. /*
  14.  * cmsender - sends certified messages on specified subject.
  15.  *
  16.  * This example publishes certified m
See the complete snippet
Language: Java
Tags: No Tags
Submitted By: rlhatcher
comments - Snippet icon comments
  1. <?php
  2. /**
  3.  * @package WordPress
  4.  * @subpackage Default_Theme
  5.  */
  6.  
  7. // Do not delete these lines
  8. if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
  9. die ('Please do not load this page directly. Thanks!');
  10.  
  11. if ( post_password_required() ) { ?>
  12. <p class="nocomments">This post is password protected. Enter the password to view comments.</p>
  13. <?php
  14.  
See the complete snippet
Language: PHP
Tags: SocialMe Wordpress
Submitted By: maeghan
JSF Utilities Class - Snippet icon JSF Utilities Class
  1. package sa.gov.ada.pm.view.utils;
  2.  
  3.  
  4. import java.util.Iterator;
  5. import java.util.Locale;
  6. import java.util.Map;
  7. import java.util.MissingResourceException;
  8. import java.util.ResourceBundle;
  9.  
  10. import javax.el.ELContext;
  11. import javax.el.ExpressionFactory;
  12. import javax.el.MethodExpression;
  13. import javax.el.ValueExpression;
  14.  
  15. import javax.faces.application.Application;
  16. import javax.faces.application.FacesMes
See the complete snippet
Language: Java
Tags: No Tags
Submitted By: agawish

Trending Snippets

Web Analytics