Skip to content

Instantly share code, notes, and snippets.

<script>
function {{ form_name }}Submit() {
$.post( '{{ path( form_path ) }}',
$('#form_{{ form_name }}').serialize(),
function(data){
$('#container_{{ form_name }}').empty().append(data);
}
);
return false;
}
$("#form_field").val(new_value);
$.post( '{{ path('form_submit_path') }}',
$('#form_name').serialize()
);
<?php
namespace ONN\UserBundle\Controller;
use FOS\UserBundle\FOSUserEvents;
use FOS\UserBundle\Event\FormEvent;
use FOS\UserBundle\Event\GetResponseUserEvent;
use FOS\UserBundle\Event\FilterUserResponseEvent;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RedirectResponse;
$actions = [];
switch($rank) {
case 3;
$actions[] = "Hit all the things";
case 2;
$actions[] = "Hit two things";
case 1:
$actions[] = "Hit a thing";
break;
}
@mstaples
mstaples / gist:c221d23e65ce8f358c91
Last active August 29, 2015 14:10
Is there a #composer #php plugin to generate a symfony bundle?
To create a new Symfony2 project:
php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/MyProject '2.5.*'
To create a new bundle structure in a Symfony2 project:
php app/console generate:bundle
<?php
namespace GoogleSpreadsheetAPI\entity;
include_once ( __DIR__ . '/../lib/autoload.php' );
use Google\Spreadsheet\SpreadsheetService as ParentSpreadsheetService;
use Google\Spreadsheet\ServiceRequestFactory;
use SimpleXMLElement;

Keybase proof

I hereby claim:

  • I am mstaples on github.
  • I am deadlugosi (https://keybase.io/deadlugosi) on keybase.
  • I have a public key whose fingerprint is 123F DA54 45E2 F3A2 ED57 5FB7 5EF7 9F0C 6438 15AA

To claim this, I am signing this object:

Route::prefix('project/{project}')->middleware('auth')->group(function() {
Route::get('/', 'ProjectController@schedule');
Route::get('schedule', 'ProjectController@schedule');
Route::get('store', 'ProjectController@store');
Route::get('audiences', 'ProjectController@audiences');
});
class PuzzleDashboard extends React.Component {
state = {
tiles: [],
emptyId: "",
emptyCol: "",
emptyRow: ""
};
componentDidMount() {
this.loadPuzzleTilesFromServer()
/* eslint-disable no-console */
/* eslint-disable no-undef */
window.client = (function () {
function getTiles(success) {
return fetch('/api/tiles', {
headers: {
Accept: 'application/json',
},
}).then(checkStatus)
.then(parseJSON)