Skip to content

Instantly share code, notes, and snippets.

@r-sal
r-sal / PHPExcel_Basics.md
Last active May 8, 2024 06:29
PHPExcel Notes and code snippets

Basics

Creating a new PHPExcel Object.

    $this->PHPExcel = new PHPExcel();

Working with sheets

Creating a new sheet:

@r-sal
r-sal / DatasetBookmarks.md
Last active February 18, 2023 16:57
List of various types of datasets

Command line one-liners

After my blog post about [command line one-liners], many people want to contribute with their own commands. This is the place to do it, pull requests are welcome!

Run the last command

$ !!

The Basics

Anonymous Closures

(function () {
	// ... all vars and functions are in this scope only
	// still maintains access to all globals
}());

Share Counts

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.

Twitter

/*
Change proposed values as necessary...
Proposed Table Name: `region`
Proposed Columns: ID(primary,), Name(char64), CountryCode(char2)
ID - varchar(6), primary key, not null
Name - varchar(64), not null
Country - char(2), not null
*/
INSERT INTO `region` VALUES
('AD-02', 'Canillo', 'AD'),
@media print {
h1{ page-break-before: always !important; }
#likes-and-labels-container{ display: none; }
}
#likes-and-labels-container{ display: none; }
h3{
{"C-Class Sedan":{"vehicles":[{"name":"C250 Sport","id":"C250WZ","label":"C250 Sport Sedan","image":"http://www.mbusa.com/vcm/MB/DigitalAssets/images/contactus/models/2014_C250WZ_BASE_158_164.png","brand":"MERCEDES"},{"name":"C250 Luxury","id":"C250W","label":"C250 Luxury Sedan","image":"http://www.mbusa.com/vcm/MB/DigitalAssets/images/contactus/models/2014_C250W_BASE_158_164.png","brand":"MERCEDES"},{"name":"C300 4MATIC Sport","id":"C300WZ4","label":"C300 4MATIC Sport","image":"http://www.mbusa.com/vcm/MB/DigitalAssets/images/contactus/models/2014_C300WZ4_BASE_158_164.png","brand":"MERCEDES"},{"name":"C300 4MATIC Luxury","id":"C300W4","label":"C300 4MATIC Luxury","image":"http://www.mbusa.com/vcm/MB/DigitalAssets/images/contactus/models/2014_C300W4_BASE_158_164.png","brand":"MERCEDES"},{"name":"C350 Sport","id":"C350W","label":"C350 Sport Sedan","image":"http://www.mbusa.com/vcm/MB/DigitalAssets/images/contactus/models/2014_C350W_BASE_158_164.png","brand":"MERCEDES"},{"name":"C63","id":"C63","label":"C63 AMG