Skip to content

Instantly share code, notes, and snippets.

@edygar
edygar / move.ts
Last active Oct 30, 2020
Move files to their kebab-version
View move.ts
import * as path from "https://deno.land/std@0.75.0/path/mod.ts";
import * as fs from "https://deno.land/std@0.75.0/fs/mod.ts";
import { paramCase } from "https://deno.land/x/case@v2.1.0/mod.ts";
const cwd = Deno.cwd();
// Files to be excluded during the walk
const skip = (await Deno.readTextFile(path.join(cwd, ".gitignore")))
.replace(/#.*/g, "")
.replace(/\s*\n/g, "\n")
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@edygar
edygar / interval.ts
Last active May 27, 2020
Deno helper to call given command each given time.
View interval.ts
/**
* # Shell interval helper
*
* Quick deno helper to call given command each given time.
*
* ## Installation:
*
* ```sh
* deno install -f --allow-run -n interval https://gist.githubusercontent.com/edygar/a1a25656d02a53c867a90fa7389ea44f/raw/interval.ts
* ```
View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@edygar
edygar / README.md
Last active Nov 21, 2017
Eslint + Prettier
View README.md

Usage

Install dependencies locally

npm install -D eslint eslint-config-airbnb eslint-config-prettier eslint-plugin-import prettier eslint-plugin-prettier eslint-plugin-jsx-a11y eslint-plugin-react flow-bin 
@edygar
edygar / .eslintrc
Last active May 30, 2016
My prefered ESlintrc
View .eslintrc
{
"extends": "eslint-config-airbnb",
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module"
},
"ecmaFeatures": {
"classes": true,
"jsx": true
},
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
init() {
setTimeout(()=>{
this.set('value',
`
<h2>Permito qualquer tag?</h2>
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
init() {
setTimeout(()=>{
this.set('value',
`
<h2>Permito qualquer tag?</h2>
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle',
selected: 0,
options: [1, 2],
actions: {
select(index) {
this.set('selected', index);
@edygar
edygar / websocket-ping-server.js
Last active Nov 17, 2015
Receives request of pings to desired hostnames and responds with the pongs at its arrival through WebSocket
View websocket-ping-server.js
import netPing from 'net-ping';
import express from 'express';
import http from 'http';
import dns from 'dns';
import socketIO from 'socket.io';
import { BehaviorSubject, Observable } from 'rx';
const app = express();
const server = http.Server(app);
const io = socketIO(server);