Skip to content

Instantly share code, notes, and snippets.

View gustavonecore's full-sized avatar
🛠️
I can kill two stones with one bird

Gustavo Delgado gustavonecore

🛠️
I can kill two stones with one bird
View GitHub Profile
@gustavonecore
gustavonecore / jobs.php
Last active October 1, 2021 13:05
Codeigniter job server dispatcher
<?php
/**
* Class to handle job execution
*/
class Jobs extends Onecore_Controller
{
const STATUS_DONE = 'done';
const STATUS_QUEUED = 'queued';
const STATUS_RUNNING = 'running';
@gustavonecore
gustavonecore / job_scheme.sql
Last active October 25, 2017 15:56
Codeigniter job table
CREATE TABLE `jobs` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(45) NOT NULL,
`payload` TEXT NULL COMMENT 'JSON payload',
`response` TEXT NULL,
`status` ENUM('running', 'queued', 'done') NOT NULL DEFAULT 'queued',
`run_time` DOUBLE NULL,
`created_dt` DATETIME NOT NULL,
PRIMARY KEY (`id`));
@gustavonecore
gustavonecore / Schedules.php
Created October 23, 2017 03:48
Codeigniter job-server - Schedules controller example
<?php
foreach ($receivers as $receiver)
{
$this->model->create('jobs', [
'name' => 'sendEmail',
'payload' => json_encode([
'subject' => 'My beautiful subject',
'type' => 'html',
'message' => 'This is an email!',
@gustavonecore
gustavonecore / job-server.sh
Created October 23, 2017 03:52
Codeigniter job server - bin bash job consumer
/usr/local/bin/php /path/to/your/ci/root/folder/index.php jobs listen
@gustavonecore
gustavonecore / App.js
Last active March 26, 2018 14:27
Container/App.js
import '../Config';
import DebugConfig from '../Config/DebugConfig';
import React, { Component } from 'react';
import { Provider } from 'react-redux';
import LoginContainer from './LoginContainer';
import HomeContainer from './HomeContainer';
import TransactionLayout from './Layout/TransactionLayout';
import CreateTransactionLayout from './Layout/CreateTransactionLayout';
import createStore from '../Redux';
import { Router, Route, browserHistory } from 'react-router';
@gustavonecore
gustavonecore / TransactionContainer.js
Created March 26, 2018 14:28
containers/TransactionContainer.js
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import TransactionActions from '../../Redux/TransactionRedux';
import TransactionComponent from '../../Components/Transaction/TransactionComponent';
import { browserHistory } from 'react-router';
import { Row, Grid, Col } from 'react-bootstrap';
import { DatePicker, RaisedButton } from 'material-ui';
import FontIcon from 'material-ui/FontIcon';
import IconButton from 'material-ui/IconButton';
import React, { Component } from 'react';
import moment from 'moment-timezone';
import TransactionRowComponent from './TransactionRowComponent';
import UploadAssetsComponent from '../Common/UploadAssetsComponent';
import {
Table,
TableBody,
TableHeader,
TableHeaderColumn,
TableRow,
@gustavonecore
gustavonecore / TransactionRowComponent.js
Created March 26, 2018 14:29
components/TransactionRowComponent
import React, { Component } from 'react';
import SelectField from 'material-ui/SelectField';
import MenuItem from 'material-ui/MenuItem';
export default class TransactionRowComponent extends Component {
state = {
value:null,
}
handleChange = (event, index, value) => {
this.setState({value});
@gustavonecore
gustavonecore / UploadAssetsComponent.js
Created March 26, 2018 14:30
components/common/UploadAssetsComponent.js
import React, { Component } from 'react';
import { Row, Grid, Col } from 'react-bootstrap';
import Dialog from 'material-ui/Dialog';
import FlatButton from 'material-ui/FlatButton';
import RaisedButton from 'material-ui/RaisedButton';
import TextField from 'material-ui/TextField';
import FontIcon from 'material-ui/FontIcon';
import {List, ListItem} from 'material-ui/List';
import IconButton from 'material-ui/IconButton';
import moment from 'moment';
sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev -y
sudo apt-get install libfreetype6 libfreetype6-dev -y
sudo apt-get install libfontconfig1 libfontconfig1-dev -y
cd ~
export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"
wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/$PHANTOM_JS.tar.bz2
sudo tar xvjf $PHANTOM_JS.tar.bz2
sudo mv $PHANTOM_JS /usr/local/share
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin