Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Weston Triemstra thermistor

🏠
Working from home
View GitHub Profile
@ceejbot
ceejbot / esm_in_node_proposal.md
Last active Jun 9, 2020
npm's proposal for supporting ES modules in node
View esm_in_node_proposal.md

ESM modules in node: npm edition

The proposal you’re about to read is not just a proposal. We have a working implementation of almost everything we discussed here. We encourage you to checkout and build our branch: our fork, with the relevant branch selected. Building and using the implementation will give you a better understanding of what using it as a developer is like.

Our implementation ended up differing from the proposal on some minor points. As our last action item before making a PR, we’re writing documentation on what we did. While I loathe pointing to tests in lieu of documentation, they will be helpful until we complete writing docs: the unit tests.

This repo also contains a bundled version of npm that has a new command, asset. You can read the documentation for and goals of that comma

@stevensona
stevensona / delayed_job@.service
Last active Apr 7, 2020
systemd unit file for running ruby/rails delayed_job as service
View delayed_job@.service
# Keep delayed job workers running using systemd on ubuntu
# Usage
# Start "sudo systemctl start delayed_job@{0..3}" to start 4 worker instances
# Enable "sudo systemctl enable delayed_job@{0..3}" to enable 4 worker instances
# Restart "sudo systemctl restart delayed_job@{0..3}" to restart 4 worker instances
# Disable "sudo systemctl disable delayed_job@{0..3}" to disable 4 worker instances
# Stop "sudo systemctl stop delayed_job@{0..3}" to stop 4 worker instances
[Unit]
Description=Delayed Job Worker %i
@tkfm-yamaguchi
tkfm-yamaguchi / lang.map.diff
Last active Feb 22, 2020
source-highlight's language definition file for YAML
View lang.map.diff
---/usr/share/source-highlight/lang.map.old
+++/usr/share/source-highlight/lang.map
@@ -169,3 +169,5 @@
groovy = groovy.lang
json = json.lang
feature = feature.lang
+yaml = yaml.lang
+yml = yaml.lang
@thevangelist
thevangelist / my-component.spec.js
Created Aug 4, 2016
The only React.js component test you'll ever need (Enzyme + Chai)
View my-component.spec.js
import React from 'react';
import { shallow } from 'enzyme';
import MyComponent from '../src/my-component';
const wrapper = shallow(<MyComponent/>);
describe('(Component) MyComponent', () => {
it('renders without exploding', () => {
expect(wrapper).to.have.length(1);
});
@mbajur
mbajur / .md
Created Apr 29, 2016
How to create small, unique tokens in Ruby
View .md

How to create small, unique tokens in Ruby

That is is basically a "fork" of blog article i'm constantly returning to. It seems that the blog is down:

My choice: Dave Bass’s rand().to_s() trick

Dave Bass proposed this which I picked up for my implementation (here for an 8-chars token):

@janko
janko / 1-activerecord.rb
Last active Jan 28, 2020
INSERTing 50,000 records into a database in ActiveRecord, Arel, SQL, activerecord-import and Sequel.
View 1-activerecord.rb
require "active_record"
ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
ActiveRecord::Migration.class_eval do
create_table(:records) do |t|
t.string :column
end
end
data = 50_000.times.map { |i| Hash[column: "Column #{i}"] }
@ebidel
ebidel / app.html
Last active Apr 23, 2020
Fast Polymer app loading - optimized for first render, progressively enhanced lazy loading
View app.html
<!DOCTYPE html>
<html>
<head>
<style>
body.loading #splash {
opacity: 1;
}
#splash {
position: absolute;
top: 0;
@dideler
dideler / upgrade-postgres-9.3-to-9.4.md
Last active Jun 8, 2020
Upgrading PostgreSQL from 9.3 to 9.4 when upgrading Ubuntu 14.04 to 14.10
View upgrade-postgres-9.3-to-9.4.md

TL;DR

Create a backup:

pg_dumpall > mybackup.sql

Perform the upgrade:

sudo pg_dropcluster 9.4 main --stop
@maxim
maxim / task.yml
Created Jun 12, 2014
Adding github to known_hosts with ansible
View task.yml
- name: ensure github.com is a known host
lineinfile:
dest: /root/.ssh/known_hosts
create: yes
state: present
line: "{{ lookup('pipe', 'ssh-keyscan -t rsa github.com') }}"
regexp: "^github\\.com"
@franksmule
franksmule / gulpfile.js
Last active Aug 8, 2017
gulp.js that does SASS, JS Concatenation Watching - Tutorial -> http://omcfarlane.co.uk/install-gulp-js-windows/
View gulpfile.js
//*********** IMPORTS *****************
var gulp = require('gulp');
var sass = require('gulp-ruby-sass');
var gutil = require('gulp-util');
var rename = require("gulp-rename");
var map = require("map-stream");
var livereload = require("gulp-livereload");
var concat = require("gulp-concat");
var uglify = require('gulp-uglify');
var watch = require('gulp-watch');
You can’t perform that action at this time.