Skip to content

Instantly share code, notes, and snippets.

@paulofreitas
paulofreitas / AuthServiceProvider.php
Last active July 7, 2023 13:15
Extending the default Eloquent User Provider (Laravel 5.4+)
<?php
namespace App\Providers;
use App\Auth\UserProvider;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
class AuthServiceProvider extends ServiceProvider
{
/**
@Manduro
Manduro / keyboard-attach.directive.ts
Last active August 24, 2020 06:50
Ionic Keyboard Attach Directive
import { Directive, ElementRef, Input, OnDestroy, OnInit } from '@angular/core';
import { Keyboard } from '@ionic-native/keyboard';
import { Content, Platform } from 'ionic-angular';
import { Subscription } from 'rxjs/Subscription';
/**
* @name KeyboardAttachDirective
* @source https://gist.github.com/Manduro/bc121fd39f21558df2a952b39e907754
* @description
@bjoerge
bjoerge / parse.js
Created March 26, 2015 19:14
Parse CSV into objects with RxJS
const Rx = require('rx');
const csv = require('csv-parse');
const fs = require('fs');
Rx.Node.fromReadableStream(fs.createReadStream('file.csv').pipe(csv()))
.skip(1)
.withLatestFrom(rows.take(1), (row, header) => {
// Map header[i] => row[i]
return row.reduce((rowObj, cell, i) => {
rowObj[header[i]] = cell;
@mathewbyrne
mathewbyrne / CsvResponse.php
Created March 21, 2013 22:54
A small Symfony 2 class for returning a response as a CSV file. Based on the Symfony JsonResponse class.
<?php
namespace Jb\AdminBundle\Http;
use Symfony\Component\HttpFoundation\Response;
class CsvResponse extends Response
{
protected $data;
@rabinjoshi
rabinjoshi / RJViewController.m
Created December 9, 2012 20:37
Loading content in a WebView using NSURLConnection
@implementation RJViewController {
__weak IBOutlet UIWebView *_webView;
NSURLConnection *_urlConnection;
NSMutableData *_receivedData;
}
- (void)viewDidLoad
{
[super viewDidLoad];
NSString *urlString = @"http://google.com";