Skip to content

Instantly share code, notes, and snippets.

View kferran's full-sized avatar

Kyle Ferran kferran

View GitHub Profile
@eralston
eralston / axios-sdk.ts
Last active November 11, 2023 19:57
Example class wrapping an Axios instance to provide a basic REST-based repository pattern
// https://www.npmjs.com/package/axios Version 0.19.2
import Axios, { AxiosInstance } from 'axios'
export interface IEntity {
example: string
}
export interface ISdk {
getAllAsync: () => Promise<IEntity[]>
@paulsturgess
paulsturgess / service.js
Last active February 2, 2024 17:24
An example Service class wrapper for Axios
import axios from 'axios';
class Service {
constructor() {
let service = axios.create({
headers: {csrf: 'token'}
});
service.interceptors.response.use(this.handleSuccess, this.handleError);
this.service = service;
}
let webpack = require('webpack');
let path = require('path');
module.exports = {
entry: {
app: './resources/assets/js/app.js',
vendor: ['vue', 'axios']
},
output: {
@agarzon
agarzon / install-php-tools.sh
Last active October 27, 2021 03:48
Install globally popular PHP dev tools like composer, phpunit, phpcs, phpmd, phpcpd, deployer, robo, codeception, etc.
#!/bin/bash
#To execute it directly: sudo bash <(curl -s https://gist.githubusercontent.com/agarzon/ecb0b92d4c8e1bbde126534c76721a58/raw/install-php-tools.sh)
BIN_PATH=/usr/local/bin/
#COMPOSER
sudo curl -LsS https://getcomposer.org/composer.phar -o ${BIN_PATH}composer
sudo chmod a+x ${BIN_PATH}composer
@josepanguera
josepanguera / 01_youtube_channel_uploads.php
Last active March 18, 2018 02:14
PHP: Get the uploaded videos of a channel using the YouTube API v3
<?php
$baseUrl = 'https://www.googleapis.com/youtube/v3/';
// https://developers.google.com/youtube/v3/getting-started
$apiKey = 'API_KEY';
// If you don't know the channel ID see below
$channelId = 'CHANNEL_ID';
$params = [
'id'=> $channelId,
'part'=> 'contentDetails',
# Example integration of a background-image uploader
# Author: Guillaume Piot
# Email: guillaume@cotidia.com
# Company: Cotidia Ltd
# Licence: MIT
#
# The div holder is absolute positioned within the parent div
#
# <div class="[ article__image ] [ article-image ] [ editable ] [ parallax ]" data-name="article_image">
# <div
@schmidt1024
schmidt1024 / svg.js
Created June 3, 2015 13:59
Replace all SVG images with inline SVG using jQuery
/*
* Replace all SVG images with inline SVG
*/
jQuery('img.svg').each(function(){
var $img = jQuery(this);
var imgID = $img.attr('id');
var imgClass = $img.attr('class');
var imgURL = $img.attr('src');
jQuery.get(imgURL, function(data) {
@macbookandrew
macbookandrew / readme.md
Last active March 8, 2020 19:31
PHP cURL proxy for Ajax—Infusionsoft

Introduction

This is a PHP proxy to submit Ajax requests to Infusionsoft.

Usage

  1. Set your Infusionsoft app id, thank-you message, and path to the cacert.pem bundle in infusionsoft-proxy-settings.php.
  2. Add the Infusionsoft form IDs in infusionsoft-proxy.php, creating new lines as necessary
  3. Include the functions.js in your javascript, making sure to replace the $form variable with the selector(s) you need.
@zajca
zajca / CSVImportCommand.php
Created October 31, 2014 07:58
Symfony2 custom command for import CSV
<?php
namespace PRIA\QuizApiBundle\Command;
use PRIA\Bundle\UserBundle\EntityRepository\RoundsRepository;
use PRIA\QuizApiBundle\Entity\Answers;
use PRIA\QuizApiBundle\Entity\Questions;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
@mlouro
mlouro / gulpfile.js
Last active June 21, 2022 23:20
gulpfile.js with browserify, jshint, libsass, browserSync for livereload, image optimization and system notifications on errors
'use strict';
var gulp = require('gulp');
var gutil = require('gulp-util');
var del = require('del');
var uglify = require('gulp-uglify');
var gulpif = require('gulp-if');
var exec = require('child_process').exec;
var notify = require('gulp-notify');