Skip to content

Instantly share code, notes, and snippets.

View jloiola's full-sized avatar
:octocat:
Focusing

Jeffrey Loiola jloiola

:octocat:
Focusing
View GitHub Profile
@matthewp
matthewp / lit-haunted-element.js
Last active October 17, 2021 15:52
Haunted State Integration
import { LitElement } from 'lit-element';
import { State } from 'haunted';
export default class LitHauntedElement extends LitElement {
constructor() {
super();
this.hauntedState = new State(() => this.requestUpdate(), this);
}
@sectore
sectore / 01-createObservableFromDeviceEventEmitter.js
Last active November 26, 2023 06:42
[React Native + RxJS] Create an Observable from DeviceEventEmitter - An example to handle 'locationUpdated' event
import React, {DeviceEventEmitter} from 'react-native';
import {Observable} from 'rx-lite'
/**
* Creates an Observable to listen to any event of DeviceEventEmitter
* @param type {string} Event type
*/
export default createObservableFromDeviceEventEmitter$ = type => {
let subscription;
return Observable.fromEventPattern(
@xmlking
xmlking / server.js
Created October 25, 2015 23:30
Koa 2.0.0 supports ES2016 async/await
import Koa from 'koa';
const app = new Koa();
// x-response-time
app.use(async (ctx, next) => {
var start = new Date;
await next();
const ms = new Date - start;
ctx.set('X-Response-Time', ms + 'ms');
@danielgtaylor
danielgtaylor / gist:0b60c2ed1f069f118562
Last active April 2, 2024 20:18
Moving to ES6 from CoffeeScript

Moving to ES6 from CoffeeScript

I fell in love with CoffeeScript a couple of years ago. Javascript has always seemed something of an interesting curiosity to me and I was happy to see the meteoric rise of Node.js, but coming from a background of Python I really preferred a cleaner syntax.

In any fast moving community it is inevitable that things will change, and so today we see a big shift toward ES6, the new version of Javascript. It incorporates a handful of the nicer features from CoffeeScript and is usable today through tools like Babel. Here are some of my thoughts and issues on moving away from CoffeeScript in favor of ES6.

While reading I suggest keeping open a tab to Babel's learning ES6 page. The examples there are great.

Punctuation

Holy punctuation, Batman! Say goodbye to your whitespace and hello to parenthesis, curly braces, and semicolons again. Even with the advanced ES6 syntax you'll find yourself writing a lot more punctuatio

@patrickarlt
patrickarlt / build.sh
Last active March 25, 2020 04:42
ES 7 async/await demo!
babel github-es6.js -o github.js --optional runtime --experimental
@suranyami
suranyami / index.html
Created September 18, 2014 07:55
Minimal Rivets.js example
<div id="details">
<h1 id='head'>{user.firstName}</h1>
<h2 rv-text='user.surname'></h2>
<input id='input' type='text' rv-value="user.firstName">
</div>
<script src='rivets.js'></script>
<script>
var user = {
@kachayev
kachayev / concurrency-in-go.md
Last active March 11, 2024 11:27
Channels Are Not Enough or Why Pipelining Is Not That Easy
@nicktoumpelis
nicktoumpelis / repo-rinse.sh
Created April 23, 2014 13:00
Cleans and resets a git repo and its submodules
git clean -xfd
git submodule foreach --recursive git clean -xfd
git reset --hard
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

@joshed-io
joshed-io / com.darkice.plist
Created November 21, 2012 18:11
launchd plists for Icecast, Darkice, Jack Audio, and Github's Play
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.darkice</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>