Skip to content

Instantly share code, notes, and snippets.

View alur222's full-sized avatar
🎯
Focusing

Raul Torrefiel Jr. alur222

🎯
Focusing
  • Cebu, Philippines
View GitHub Profile
@alur222
alur222 / gulpfile.js
Created August 7, 2018 04:22
Sample gulp file for node js development with auto reload
const gulp = require('gulp');
const spawn = require('child_process').spawn;
let node;
function server() {
if (node) {
node.kill();
}
node = spawn('npm', ['run', 'runserver'], {stdio: 'inherit'});
node.on('close', function (code) {
@alur222
alur222 / sample_test.js
Created August 7, 2018 04:32
sample mocha, chai and sinon test file
process.env.NODE_ENV = 'test';
const chai = require('chai');
const should = chai.should();
const chaiHttp = require('chai-http');
chai.use(chaiHttp);
const server = require('../../src/app.js');
describe('routes : index', () => {
@alur222
alur222 / authVerify.js
Last active April 2, 2019 06:55
verfying token authenticity from localStorage
// replace LS_ITEM_NAME with your localstorage item name
// REACT_APP_BACKEND_HOST
// server should accept custom header "x-access-token"
export const AuthVerify = async () => {
const token = localStorage.getItem(LS_ITEM_NAME);
if (!token) {
return Promise.reject(false);
}
return axios.request({
@alur222
alur222 / gist:506fb6d233ec09986d6e1720a346b6b0
Last active February 16, 2024 10:57
bonfire controller
<?php
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
class Business extends Front_Controller {
public function __construct() {
parent::__construct();