Skip to content

Instantly share code, notes, and snippets.

View lisp-ceo's full-sized avatar
🎇
Key Contributor

James Meldrum lisp-ceo

🎇
Key Contributor
View GitHub Profile
func expand(s string, f func(string) string) string {
if len(s) < len(FOO) {
return s
}
for i := strings.Index(s, FOO); i != -1; i = strings.Index(s, FOO){
t := s[:i]
t = t + f(s[i+1:i+len(FOO)])
t = t + s[i+len(FOO):]
s = t
}
~/code/maxwellforest/onefill_maps_api $ curl "https://mighty-wildwood-25794.herokuapp.com/v0/sites/562" -X GET \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: "
{"site":{"id":562,"blocked":false,"name":"Coffee Company","normalized_name":"Coffee Company","url":"https://www.coffeecompany.com.au","logo":{"content_type":"image/png","url":{"x1":"//s3-ap-southeast-2.amazonaws.com/76f1fe6d3b3/sites/logos/000/000/562/x1/open-uri20160902-3-t40872?1474272742","x2":"//s3-ap-southeast-2.amazonaws.com/76f1fe6d3b3/sites/logos/000/000/562/x2/open-uri20160902-3-t40872?1474272742","x3":"//s3-ap-southeast-2.amazonaws.com/76f1fe6d3b3/sites/logos/000/000/562/x3/open-uri20160902-3-t40872?1474272742","original":"//s3-ap-southeast-2.amazonaws.com/76f1fe6d3b3/sites/logos/000/000/562/original/open-uri20160902-3-t40872?1474272742"}},"updated_at":"2016-09-19T18:12:24.544+10:00","created_at":"2016-09-02T10:43:36.143+10:00","fetch_count":188,"deleted_at":null,"featured":null,"flow_mappings":
require 'json'
require 'net/http'
require 'thread'
if RUBY_VERSION.to_i < 2
puts "Use a modern ruby => 2.3.1 suggested"
return 1;
end
API_ENDPOINT = 'http://mighty-wildwood-25794.herokuapp.com/'
@lisp-ceo
lisp-ceo / xtime
Created July 3, 2016 23:59
HTMLDRUM'S ELITE HACK UNIVERSAL PERFORMANCE FORMALUZ
#!/bin/sh
time -f '%Uu %Ss %er %MkB %C' "$@"
@lisp-ceo
lisp-ceo / one-liners.md
Created June 17, 2016 10:00 — forked from KL-7/one-liners.md
Ruby one-liners

One-liners

Reverse every line:

Input file:

$ cat foo
qwe
123

bar

@lisp-ceo
lisp-ceo / ember-macros.js
Last active March 9, 2016 19:41
Ember Macros?
// imported with `import {*Strategy from 'ember-macros'}`
// @TODO: Find ember-cli-compatible
import E from 'ember';
export let isContractorsStrategy = E.Mixin.create({
isProductsStrategy: E.computed('strategy', function(){
return this.get('strategy') === "products";
})
});
export let isProductsStrategy = E.Mixin.create({
persistAttachment(){
this.set('isLoading', true);
return new E.RSVP.Promise(function(resolve, reject){
let [formData, model, adapter] = [new FormData(), this.getModel(), window.App.lookup('adapter:attachment')];
let [ajaxOptions, snapshot, contentType] = [adapter.ajaxOptions(), model._createSnapshot(), model.get('content_type')];
let url = adapter.urlForCreateRecord('task', snapshot);
let normalizeAjaxOptions = (ao)=>{
ao.type = 'POST';
ao.url = url;
@lisp-ceo
lisp-ceo / gist:b4f09ac96835dfd7dceb
Created February 15, 2016 23:23
Ruby Memory Model
Ruby Memory Model
Indented italic paragraphs are used for notes.
This document is work-in-progress. Intentions of this effort and document are: to summarize the behavior of Ruby in concurrent and parallel environments, initiate the discussion, identify problems in the document, find flaws in Ruby implementations if any, suggest what has to be enhanced in Ruby itself and cooperate on adding the enhancements to Ruby implementations.
It is not the intention of this effort to introduce high-level concurrency abstractions like actors to the language, but rather to improve low-level concurrency support to add many more concurrency abstractions through gems.
For readers and reviewers: Thank you for taking time to read this document and provide feedback or ask questions, both are very valuable. The document is locked against direct editing, but please comment by selecting text and clicking “Insert comment” button, or you can suggest changes by directly editing the text. You can choose to be notified about all comment
@lisp-ceo
lisp-ceo / Converting libraries to Ember CLI addons.md
Created February 5, 2016 09:37 — forked from kristianmandrup/Converting libraries to Ember CLI addons.md
Guide to Developing Addons and Blueprints for Ember CLI

Converting libraries to Ember CLI addons

In this guide we will cover two main cases:

  • Ember specific library
  • vendor library

Ember library

The Ember library will assume that Ember has already ben loaded (higher in the loading order) and thus will assume it has access to the Ember API.

@lisp-ceo
lisp-ceo / nginx.conf
Created January 6, 2016 00:52
Simple nginx lua script to add UUID to each request for end to end request tracking.
# Dependencies
# nginx_lua
# lua uuid module (luarocks install uuid)
http {
# this will be the request id
map $host $request_uuid {
default '';
}