Skip to content

Instantly share code, notes, and snippets.

@searls
searls / client.js
Created May 13, 2018
Sometimes I find it handy when I'm developing a single page app to have all front-end errors forwarded to the backend's log (when something doesn't work, I can look in a single terminal window)
View client.js
const puts = (...anything) => {
fetch("/api/puts", {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({content: anything})
})
}
@balupton
balupton / Bevry-Code-of-Conduct.md
Last active Nov 15, 2017
Seems the open-source world requires a code of conduct for everything right now. So here is a draft one I’ve done up for Bevry. Feedback welcome.
View Bevry-Code-of-Conduct.md

Bevry Draft Code of Conduct

TLDR: Be a productive member of civilised society, no more, no less.

Results > Character > Identity.

We care only about your character and your results. We discriminate at the individual level, not the group identity level. You can be whatever identity you want, your identity is your thing not ours, identity is meaningless to us.

Libertarian Values.

@haasn
haasn / about:config.md
Last active Sep 17, 2021
Firefox bullshit removal via about:config
View about:config.md

Firefox bullshit removal

Updated: Just use qutebrowser (and disable javascript). The web is done for.

@staltz
staltz / introrx.md
Last active Sep 17, 2021
The introduction to Reactive Programming you've been missing
View introrx.md
@pcreux
pcreux / 0-gourmet-service-objects.md
Last active Dec 21, 2018
Gourmet Service Objects - Lightning Talk - http://vanruby.org - Feb 27, 2014
View 0-gourmet-service-objects.md

Gourmet Service objects

 @pcreux

 Feb 27, 2014
 http://vanruby.org
@juanje
juanje / gist:3797297
Created Sep 28, 2012
Mount apt cache of a Vagrant box in the host to spin up the packages installation
View gist:3797297

This is a little trick I use to spin up the packages instalation on Debian/Ubuntu boxes in Vagrant.

I add a simple function that checks if a directory named something similar to ~/.vagrant.d/cache/apt/opscode-ubuntu-12.04/partial (it may have another path in Windows or MacOS) and create the directory if it doesn't already exist.

def local_cache(basebox_name)
  cache_dir = Vagrant::Environment.new.home_path.join('cache', 'apt', basebox_name)
  partial_dir = cache_dir.join('partial')
  partial_dir.mkdir unless partial_dir.exist?
  cache_dir
@vicentereig
vicentereig / ruby_csv_simple_object_mapping.rb
Last active Oct 7, 2015
Awesome FasterCSV Features. Thanks @JEG2
View ruby_csv_simple_object_mapping.rb
# http://ruby-doc.org/stdlib-1.9.2/libdoc/csv/rdoc/CSV.html#method-c-load
# http://ruby-doc.org/stdlib-1.9.2/libdoc/csv/rdoc/CSV.html#method-c-dump
# https://github.com/JEG2/faster_csv/blob/master/test/tc_serialization.rb
require 'csv'
class Person
attr_accessor :id, :name, :email
def self.csv_load(meta, headers, row)
person = Person.new
@drj42
drj42 / org-mode-reference-in.org
Created Feb 6, 2012
This is a cheat sheet for Emacs org-mode... in org-mode format!
View org-mode-reference-in.org
View route_spec.rb
describe "routes to the articles controller" do
extend RouteSpecHelpers
scope_options controller: 'articles', blog: 'my_blog' do
get '/blogs/my_blog/articles/new' => { action: 'new' }
post '/blogs/my_blog/articles' => { action: 'create' }
get '/blogs/my_blog/articles/1' => {action: 'show', id: '1' }
end
end
View route_spec.rb
describe "routes to the articles controller" do
extend RouteSpecHelpers
scope_options controller: 'articles', blog: 'my_blog'
get '/blogs/my_blog/articles/new' => { action: 'new' }
post '/blogs/my_blog/articles' => { action: 'create' }
get '/blogs/my_blog/articles/1' => {action: 'show', id: '1' }