Skip to content

Instantly share code, notes, and snippets.

View omar-vasquez-dev's full-sized avatar

Omar Vasquez omar-vasquez-dev

View GitHub Profile
@mpijierro
mpijierro / download_csv.php
Last active November 25, 2024 23:52
Example streaming large CSV files with Laravel and thousands of queries
<?php
namespace Src\Csv;
use Illuminate\Http\Response;
use Symfony\Component\HttpFoundation\StreamedResponse;
/**
* Class DownloadLargeCsv
*
@joseluisq
joseluisq / 1README.md
Created April 19, 2017 07:33
How add a custom field to Laravel 5.4 default login. LoginController.php

How add a custom field to Laravel 5.4 default login controller.

In this php example (app/Http/Controllers/Auth/LoginController.php) my model is called Client and the custom field for login validation is status. (Client->status)

Add in your resources/lang/en/auth.php file :

    'failed_status' => 'Your account is inactive yet. Please confirm your e-mail address.',
@stubailo
stubailo / recompose.jsx
Last active January 22, 2019 02:05
Using Recompose to manage variables in react-apollo
import React from 'react';
import { withState, pure, compose } from 'recompose';
import gql from 'graphql-tag';
import { graphql } from 'react-apollo';
import { Link } from 'react-router';
// The data prop, which is provided by the wrapper below, contains
// a `loading` key while the query is in flight, and the bookSearch
// results when they are ready
const BookSearchResultsPure = ({ data: { loading, bookSearch } }) => {
@musatov
musatov / gulpfile.js
Created February 4, 2016 16:42
Gulp development and production configuration for polymer application written at es6
'use strict';
// Development web-server
const browserSync = require('browser-sync').create();
// Babel plugin for transpiling ES6 code to JS
const babel = require('gulp-babel');
// Tool for separating html and js code
const crisper = require('gulp-crisper');
// Sourcemaps generation for debugin ES6 at browser
const sourcemaps = require('gulp-sourcemaps');
@wuct
wuct / AuthorizationHOC.js
Created December 22, 2015 06:22
An authorization high-order-component using recompose, redux and react-router.
import { emptyObject } from 'fbjs/lib/emptyObject';
import { connect } from 'react-redux';
import { pushState } from 'redux-router';
import pure from 'recompose/pure';
import defaultProps from 'recompose/defaultProps';
import doOnReceiveProps from 'recompose/doOnReceiveProps';
import renderNothing from 'recompose/renderNothing';
import renderComponent from 'recompose/renderComponent';
import branch from 'recompose/branch';
import compose from 'recompose/compose';
@mindplay-dk
mindplay-dk / session-life-cycle.md
Last active August 26, 2024 23:46
Complete overview of the PHP SessionHandler life-cycle

This page provides a full overview of PHP's SessionHandler life-cycle - this was generated by a set of test-scripts, in order to provide an exact overview of when and what you can expect will be called in your custom SessionHandler implementation.

Each example is a separate script being run by a client with cookies enabled.

To the left, you can see the function being called in your script, and to the right, you can see the resulting calls being made to a custom session-handler registed using session_set_save_handler().

@icchan
icchan / RegexCardValidator.java
Last active May 16, 2024 04:13
Java Credit Card Number Validator
package net.bubblemix.cardcheck;
/**
* Validator for credit card numbers
* Checks validity and returns card type
*
* @author ian.chen
*/
public class RegexCardValidator {
@jimothyGator
jimothyGator / README.md
Last active July 30, 2025 07:45
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/