Skip to content

Instantly share code, notes, and snippets.

View linxlad's full-sized avatar

Nathan Daly linxlad

  • Bury St Edmunds, England
View GitHub Profile
import React, { Component, PropTypes } from 'react';
import { View, Image, TextInput, Text, Dimensions, Alert } from 'react-native';
import { Font } from 'expo';
import { connect } from 'react-redux';
import { LoginButton } from '../SubComponents/LoginComponent/LoginButton';
import { loginUser } from '../../actions'
class Login extends Component {
static propTypes = {
loginUser: PropTypes.func,
@linxlad
linxlad / QRLogo.php
Created February 28, 2017 10:31 — forked from NTICompass/QRLogo.php
QR Code + Logo Generator
<?php
/**
* QR Code + Logo Generator
*
* http://labs.nticompassinc.com
*/
$data = isset($_GET['data']) ? $_GET['data'] : 'http://labs.nticompassinc.com';
$size = isset($_GET['size']) ? $_GET['size'] : '200x200';
$logo = isset($_GET['logo']) ? $_GET['logo'] : FALSE;
@linxlad
linxlad / proxy.php
Last active August 12, 2019 15:48 — forked from iovar/proxy.php
Simple PHP Proxy Script
<?php
$method = $_SERVER['REQUEST_METHOD'];
if ($_GET && $_GET['url']) {
$headers = getallheaders();
$headers_str = [];
$url = $_GET['url'];
foreach ( $headers as $key => $value){
if($key == 'Host')
@linxlad
linxlad / FormErrorsSerializer.php
Last active August 18, 2023 11:20 — forked from Graceas/FormErrorsSerializer.php
Symfony 2 Form Error Serializer. May be used for AJAX form validation. Allows tree and flat array styles for errors.
<?php
namespace OpenObjects\Bundle\CoreBundle\Service;
use Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapper;
use Symfony\Component\Form\Form;
use Symfony\Component\Form\FormError;
use Symfony\Component\Validator\ConstraintViolation;
/**
@linxlad
linxlad / script.sql
Created July 1, 2016 10:13 — forked from vielhuber/README.MD
PostgreSQL: Concat two strings intelligently
SELECT CONCAT(
first_name,
(CASE WHEN (first_name IS NULL OR first_name = '') THEN '' ELSE ', ' END),
last_name
) FROM members
@linxlad
linxlad / 1-Explanations.md
Created June 12, 2016 22:43 — forked from danvbe/1-Explanations.md
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.
@linxlad
linxlad / example.go
Created April 10, 2016 18:54 — forked from yanmhlv/example.go
simple DRY controller. golang github.com/labstack/echo example
package main
import (
"fmt"
"net/http"
"reflect"
"strconv"
"github.com/jinzhu/gorm"
"github.com/labstack/echo"
@linxlad
linxlad / gist:a5f8604a4e3159eb8ef0
Created February 15, 2016 11:02 — forked from plasticbrain/gist:3887245
PHP: mime types (array format)
<?php
$mime_types = array(
'.3dm' => 'x-world/x-3dmf',
'.3dmf' => 'x-world/x-3dmf',
'.a' => 'application/octet-stream',
'.aab' => 'application/x-authorware-bin',
'.aam' => 'application/x-authorware-map',
'.aas' => 'application/x-authorware-seg',
'.abc' => 'text/vnd.abc',
'.acgi' => 'text/html',
<?php
class CsvTableLogHandler extends \Phalcon\Mvc\Model
{
private $table;
public function __construct($tableName)
{
$this->table = $tableName;
<?php // file [project]/Library/View.php
namespace YourNamespace\Library;
class extendedView extends \Phalcon\Mvc\View
{
public function getPartial($path, $params = array())
{
ob_start();
$this->partial($path, $params);
return ob_get_clean();