Skip to content

Instantly share code, notes, and snippets.

View kuroisuna's full-sized avatar
🐕
Probably working with javascript 🤔

Axel García kuroisuna

🐕
Probably working with javascript 🤔
  • Santiago, Chile
View GitHub Profile
<?php
/* Change to the correct path if you copy this example! */
require __DIR__ . '/vendor/autoload.php';
use Mike42\Escpos\Printer;
use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;
/**
* Install the printer using USB printing support, and the "Generic / Text Only" driver,
* then share it (you can use a firewall so that it can only be seen locally).
*

Keybase proof

I hereby claim:

  • I am kuroisuna on github.
  • I am axelgarcia (https://keybase.io/axelgarcia) on keybase.
  • I have a public key ASB9DZfZjw-ddCNNr11GdHkg8Re87zPPaH9gqJ_aNd0dcQo

To claim this, I am signing this object:

<?php
...
$rules = [
'name' => 'required',
'age' => 'required|numeric|min:18',
'email' => 'email',
];
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<style id="jsbin-css">
@kuroisuna
kuroisuna / Preferences.sublime-settings
Created February 7, 2017 22:02
sublime-text-config
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"close_windows_when_empty": true,
"color_scheme": "Packages/Material Theme/schemes/Material-Theme-Lighter.tmTheme",
"ensure_newline_at_eof_on_save": true,
"font_face": "Operator Mono",
"font_size": 15,
"ignored_packages":
[
<?php
if (!function_exists('post_to_put')) {
/**
* Turns POST/STORE rules to PUT/PATCH/UPDATE ones
*
* @param array $rules Validation rules array
* @param string $ignore Value to ignore
* @param string $additional Additional where clauses
*
@kuroisuna
kuroisuna / send_notification.js
Created September 22, 2016 17:41
NODE: Easily send Push Notifications through PushBullet
// Important to use dotenv (https://www.npmjs.com/package/dotenv) for security reasons
// every saved env variable is available inside "process.env"
require("dotenv").config();
var redis = require("redis");
var pushBullet = require("pushbullet");
require("moment");
var exec = require('child_process').exec;
var promise = require('promise');
// Localized Date
var moment = require('moment-timezone');
@kuroisuna
kuroisuna / javascript_nodes.js
Last active September 22, 2016 15:44
JS: Get node properties and values with vanilla javascript
// If we need the value of some form items
// Retrieve the form by its id
var formId = "users-form";
var form = document.forms[formId];
var userId = form.querySelector("[name=user-id]");
var userName = form.querySelector("[name=user-name]");
var userAge = form.querySelector("[name=user-age]");
var userIdValue = userId.value;
// Example XHR with those values
@kuroisuna
kuroisuna / oop_in_javascript.js
Created September 20, 2016 02:02
JS: Simple OOP private/public methods and properties
var helper = function (element) {
/**
* [private] Base HTML div
* @type {HTMLDivElement}
*/
var element = element;
/**
* [public] Count of base element childrens
* @type {Number}
@kuroisuna
kuroisuna / transpose_rows.sql
Last active September 17, 2016 04:04
SQL: Transposing rows without subqueries
-- Say we have this table called selected_colors:
-- +----------------+
-- | type | value |
-- +--------+-------+
-- | blue | 1 |
-- | red | 4 |
-- | yellow | 8 |
-- | red | 12 |
-- | blue | 5 |
-- | blue | 0 |