Skip to content

Instantly share code, notes, and snippets.

View zender's full-sized avatar

Nikolay Georgiev zender

  • EU
View GitHub Profile
@jack-guy
jack-guy / feathers.d.ts
Last active September 7, 2017 10:34
These are basic typings for Feathers.js based off of those in DefinitelyTyped for Express. This doesn't type feathers plugins, but does have some interfaces that can be used in them. WIP.
// Type definitions for Feathers
// Project: http://feathersjs.com/
// Definitions by: Jack Guy <http://thatguyjackguy.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Application, Handler, ErrorRequestHandler } from 'express';
type HandlerArgument = Handler | Handler[];
export = Feathers;
@brennanMKE
brennanMKE / hero.ts
Last active April 1, 2024 16:16
Example of Mongoose with TypeScript and MongoDb
import * as mongoose from 'mongoose';
export let Schema = mongoose.Schema;
export let ObjectId = mongoose.Schema.Types.ObjectId;
export let Mixed = mongoose.Schema.Types.Mixed;
export interface IHeroModel extends mongoose.Document {
name: string;
power: string;
@maximecolin
maximecolin / ConsoleListener.php
Last active August 15, 2023 21:17
Symfony2 : Configuring the Request Context for CLI Command
<?php
namespace Acme\DemoBundle\EventListener;
use Symfony\Component\Routing\RouterInterface;
class ConsoleListener
{
/**
* @var RouterInterface
@kriswallsmith
kriswallsmith / gist:5819198
Last active December 18, 2015 17:29
How do you walk a paginated API?
<?php
function walk($callback)
{
$page = 1;
do {
$results = fetch($page++, 100);
foreach ($results as $result) {
call_user_func($callback, $result);
@psrpinto
psrpinto / IPN Handler.md
Last active December 1, 2016 08:47
A plug-and-play handler for Paypal's Instant Payment Notification (IPN) system to be used with JMSPaymentCoreBundle and JMSPaymentPaypalBundle.

IPN handler

A plug-and-play handler for Paypal's Instant Payment Notification system to be used with JMSPaymentCoreBundle and JMSPaymentPaypalBundle. Includes support for Refunds. It's assumed that you are using the JMSPayment bundles to handle the checkout workflow as described here.

It's as simple as:

<?php namespace Acme\SomeBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller
@danvbe
danvbe / 1-Explanations.md
Last active April 21, 2023 15:39
A way to integrate FosUserBundle and HWIOAuthBundle

I have managed to install this… and make it work. I implemented it for Facebook and Google, but you can extend it. My solution it is mostly as described in #116, with a bit of more code presented. The key aspects that lack in the #116 presentation (IMO) are:

  • the registration as service of your custom FOSUBUserProvider (with the necessary parameters)
  • set the service for oauth_user_provider in the security.yml with your custom created service

Here are the steps:

  1. Routing. In routing.yml I have added all the routes for both bundles.
  2. Configuration. I have set the config.yml mostly as it is presented in the HWIOAuthBundle.
  3. Security. I have set the security.yml mostly as it is presented in the HWIOAuthBundle (though my routes are using /login pattern, not /connect). Also, the oauth_user_provider is set for my custom service.
@JCook21
JCook21 / deploy.rb
Created November 11, 2012 18:29
Sample Capifony Deployment script
# Deployment server info
set :application, "APP NAME"
set :domain, "APP DOMAIN NAME"
set :deploy_to, "/path/on/live/server"
set :app_path, "app"
set :web_path, "web"
set :maintenance_basename, "maintenance"
# SCM info
set :repository, "GIT REMOTE REPO URL"
@nielsmouthaan
nielsmouthaan / MenuBuilder.php
Created September 22, 2012 10:21
Custom KnpMenuBundle navigation bar twig template to support Font Awesome icons & Twitter bootstrap lay-out
<?php
namespace Acme\HelloBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
class MenuBuilder extends ContainerAware
{
public function mainMenu(FactoryInterface $factory, array $options)
@leon
leon / nginx.conf
Created June 29, 2012 16:34
Nginx PHP-FPM Symfony 2 minimal config
server {
listen 80;
server_name localhost;
root /home/website/web;
rewrite ^/app\.php/?(.*)$ /$1 permanent;
try_files $uri @rewriteapp;
location @rewriteapp {
@stephenvisser
stephenvisser / app.js
Created May 16, 2012 15:45
Using Twitter Bootstrap NavBars with Backbone.js
//This is the Backbone controller that manages the content of the app
var Content = Backbone.View.extend({
initialize:function(options){
Backbone.history.on('route',function(source, path){
this.render(path);
}, this);
},
//This object defines the content for each of the routes in the application
content:{
"":_.template(document.getElementById("root").innerHTML),