Skip to content

Instantly share code, notes, and snippets.

View apisandipas's full-sized avatar

Bryan Paronto apisandipas

View GitHub Profile
@jfeust
jfeust / README.md
Created July 5, 2011 00:11 — forked from napcs/README.md
Deploying Rails to Linode

Deploying Rails to Linode

Installing Ruby Enterprise Edition, Apache, MySQL, and Passenger for deploying Rails 3.0 applications.

Get a Linode, and set it up with Ubuntu 10.04 LTS so that you have till April 2013 to get updates. Once the Linode is formatted, boot it and continue on.

Set up an 'A' record in your DNS, pointing to the IP of your Linode. I'm using demo.napcs.com here.

Initial setup

@coolaj86
coolaj86 / how-to-publish-to-npm.md
Last active June 9, 2024 23:19
How to publish packages to NPM

Getting Started with NPM (as a developer)

As easy as 1, 2, 3!

Updated:

  • Aug, 08, 2022 update config docs for npm 8+
  • Jul 27, 2021 add private scopes
  • Jul 22, 2021 add dist tags
  • Jun 20, 2021 update for --access=public
  • Sep 07, 2020 update docs for npm version
@thulstrup
thulstrup / compass-retina-sprites.scss
Created March 20, 2012 19:18
Using Compass to generate normal and retina sprite maps
$sprites: sprite-map("sprites/*.png");
$sprites-retina: sprite-map("sprites-retina/*.png");
@mixin sprite-background($name) {
background-image: sprite-url($sprites);
background-position: sprite-position($sprites, $name);
background-repeat: no-repeat;
display: block;
height: image-height(sprite-file($sprites, $name));
width: image-width(sprite-file($sprites, $name));
@bainternet
bainternet / gist:2175805
Created March 23, 2012 22:32
simple view counter for wordpress plugin
<?php
/*
Plugin Name: Simple Post Views
Plugin URI: http://en.bainternet.info
Description: Simple And lightweight plugin to track post views.
Version: 0.2
Author: Bainternet
Author URI: http://en.bainternet.info
*/
if ( !class_exists('PostViews')){
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

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

@hinnerk-a
hinnerk-a / wp_log_http_requests.php
Created May 31, 2012 20:31
WordPress filter hook for logging WP HTTP requests
<?php
function wp_log_http_requests( $response, $args, $url ) {
// set your log file location here
$logfile = plugin_dir_path( __FILE__ ) . '/http_requests.log';
// parse request and response body to a hash for human readable log output
$log_response = $response;
if ( isset( $args['body'] ) ) {
@ialpert
ialpert / paginate.js
Created July 18, 2012 12:02
paginate extension for lodash/underscore
_.paginate = function(arr, size) {
var pages = [];
size = size || this.length;
while (arr.length) {
pages.push(arr.splice(0, size));
}
return pages;
@wpsmith
wpsmith / wp_user_query.php
Created August 14, 2012 21:37
WP_User_Query
<?php
/**
* WordPress WP_User_Query Comprehensive Reference
* Compiled by wpsmith - wpsmith.net
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_User_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.4.1/wp-includes/user.php
*/
$args = array(
@tomdale
tomdale / gist:4242136
Created December 8, 2012 21:52
{{#each}} docs

Displaying a List of Items

If you need to enumerate over a list of objects, use Handlebar's {{#each}} helper:

<ul>
  {{#each people}}
    <li>Hello, {{name}}!</li>
  {{/each}}
</ul>
@gutenye
gutenye / ember-with-middleman.md
Last active December 10, 2015 01:58
Write Ember.js App With Middleman

I. Create a Middleman project with middleman-ember-template

$ middleman init hello --template=ember

II. Install ember.js package

$ bower install ember