Skip to content

Instantly share code, notes, and snippets.

View jakebellacera's full-sized avatar

Jake Bellacera jakebellacera

View GitHub Profile
var appName = "yourAppName",
keywords = encodeURI("my search term"),
url = "http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsByKeywords&SERVICE-VERSION=1.0.0&SECURITY-APPNAME=" + appName + "&RESPONSE-DATA-FORMAT=XML&REST-PAYLOAD&keywords=" + keywords;
$.get(url, function (response) {
console.log(response);
// response would be the parsed XML body.
// you could then work with this by treating it as an DOM
// node in jQuery. For example:
// response.find('elementName').html()
@jakebellacera
jakebellacera / sass_function_var.rb
Created March 14, 2014 04:52
Dynamically calls a SASS variable by a string (e.g. var("foo" + "bar") => $foobar).
# To use this in your SASS project, simply load this module into
# your environment.
module Sass::Script::Functions
# Dynamically calls a variable by a string
# e.g. var("foo" + "bar") => $foobar
def var(name)
assert_type name, :String, :name
@environment.var(name.value)

Just testing notes in Markdown. The one below is in a blockquote:

Protip! Press + Q to make your Mac faster.

The one below is squished between to hrs:


Important! This is something you should know about.

#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
@jakebellacera
jakebellacera / frontend-optimization-techniques.md
Created July 13, 2014 04:29
A random write-up discussing front-end optimization techniques

Below are a list of best practices and techniques that you should be using while building out your HTML5 banners (and other websites).

Styles

CSS should be clear and concise. You should not have any rules that are unused. You can check for unused styles by running the "Audit" feature found in Chrome's Developer Tools. Try to combine rules if possible to retain wasted bytes.

JS

JS should be clear and concise. Try not to use external libraries at all if possible. Try to leverage recursive functions whenever possible to reduce byte-size.

@jakebellacera
jakebellacera / backbone.dsl.coffee
Last active August 29, 2015 14:04
an example demoing a DSL for backbone objects
class Something extends Backbone.Model
is: ["validatable", "sortable"]
validations:
phoneNumber:
required:
message: "this is a custom message for when you're missing the phone number!"
matches: /\d{10}/
sortable:
@jakebellacera
jakebellacera / 2x-bg-images.less
Created April 6, 2015 19:13
simple 2x images in LESS
// Sets a 1x and a 2x background-image on an element.
//
// Arguments:
// @path - a String path to the 1x version of the image. The 2x version of this
// image must exist in the same directory as the 1x and have "_2x" at
// the end of its filename.
// @size - the value for the background-size attribute (e.g. 10px 20px; 100%).
.bg-image(@path, @size) {
background-image: url(@path);
background-size: @size;
@jakebellacera
jakebellacera / dateToUnix.php
Created October 19, 2010 19:31
Quick little function to convert date strings to unix timestamps
// The Function
function dateToUnix($time) {
return date('U', strtotime($time));
}
// Example:
// We need to convert a simple string to a UNIX timestamp.
$sampleDate = '9/15/2010 05:30';
@jakebellacera
jakebellacera / columns_template.less
Created November 18, 2010 20:32
Columns template for LESS CSS
/************************
Columns
=======
General template for creating columns.
Usage
-----
To use, just set a parent div with three different classes:
* .columns -- this defines the column class
<?php
// RFLX <img> resize
// server-side image resizing
function rflx_img_resize($src, $width, $height, $mu = true, $zoom = true) {
if ($zoom) {
if ($zoom == false) {
$z = 0;
} else {
$z = 1;