Skip to content

Instantly share code, notes, and snippets.

View buzzedword's full-sized avatar
:octocat:
Live and in stereo

Danny Garcia buzzedword

:octocat:
Live and in stereo
View GitHub Profile
$("#submit-btn").on('click', function(event) {
event.preventDefault();
var form, url, data, requests;
form = $("#form");
url = form.attr('action');
data = form.serializeArray();
requests = {
getJsonAction : 'http://url.com' // No query param here. jsonp mode sets it.
@buzzedword
buzzedword / JsonController.php
Last active December 13, 2015 17:19
Using JSONP with FosRestBundle
<?php
namespace Demo\Bundle\Controller;
use FOS\RestBundle\Controller\FOSRestController;
use Symfony\Component\HttpFoundation\JsonResponse; // Helper added in Symfony 2.1 for JSON responses
class JsonController extends FOSRestController
{
public function getJsonAction()
{
$data = array(
<?php
// Stuff to figure out:
// - where should this file live and in what folder structure of /vendor
// - what namespace should this class have
// - how do you autoload this class?
// - how do you use this class within a controller
namespace Custom\Bundle\HelloWorldBundle;
<?php
// Stuff to figure out:
// - where should this file live and in what folder structure of /vendor
// - what namespace should this class have
// - how do you autoload this class?
// - how do you use this class within a controller
namespace Quickbase\Quickbase\{foldername};
@buzzedword
buzzedword / composer.json
Created October 22, 2012 15:37
symfony 2.1
{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": {
"": "src/",
"ACH": "vender/quickbase/quickbase"
}
},
"require": {
@buzzedword
buzzedword / bower-hitlist.md
Created September 21, 2012 19:55
Making the web a better place: Bower Hitlist

NEW Organization Repo

Please find the new location for the bower hitlist in Github Orgs, rather than Gists. See you there!

https://github.com/bower-hitlist/bower-hitlist.github.com

Overview

Today, I'm starting a small campaign to make the state of the web better in my own way. With the advent of a unified package system like bower, it has never been easier to improve the lives of developers everywhere!

@buzzedword
buzzedword / ua.min.js
Created September 11, 2012 21:47
Minified UA library.
/*jslint browser: true, regexp: true, maxerr: 50, indent: 4 *//**
* A UserAgent detection library.
*
* This library relies on the navigator.userAgent property and hence does not
* work for custom UserAgent settings.
*
* Apart from supporting detection of major browser vendors, the library also
* supports detection of various devices.
*
* Copyright (c) 2012, Gopalarathnam Venkatesan
@buzzedword
buzzedword / git-trackall
Created July 11, 2012 02:01
Add to a folder on your path, chmod 755, run with git trackall
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master`; do git branch --track ${branch##*/} $branch; done
git fetch --tags
git fetch --all
@buzzedword
buzzedword / grunt-recess.js
Created July 10, 2012 22:25
Grunt.js for grunt-recess
/*global module:false*/
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-recess');
var recessOptions = function(bool) {
bool = ((typeof bool === 'undefined')? false : bool);
var config = {
compile: true,
compress: bool,
var click_or_tap = function(obj) {
//for property in obj, add "click " to property and use original value
var new_obj = {};
for(var property in obj) {
if (obj.hasOwnProperty(property)) {
if (forge.is.mobile()) {
new_obj["tap " + property] = obj[property];
}
else {
new_obj["click " + property] = obj[property];