Skip to content

Instantly share code, notes, and snippets.

View Ell's full-sized avatar
😝
coding? more like living! haha i love coding so much :)

Ell Ell

😝
coding? more like living! haha i love coding so much :)
View GitHub Profile
@Ell
Ell / d2.csv
Created January 15, 2020 15:28
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Save New Duplicate & Edit Just Text Twitter
1
2
3
4
5
6
7
8
import './Resizable.scss';
import * as React from 'react';
import { clamp } from 'lodash';
export class Resizable extends React.Component {
state = {
width: this.props.defaultWidth
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
renderCanvas () {
const {ctx, img, offset, zoom} = this.state;
const {width, height} = this.props;
const cappedZoom = Math.max(1, zoom);
const imgSize = Math.min(img.width, img.height);
const left = (img.width - imgSize) / 2;
const top = (img.height - imgSize) / 2;
let hMovement = (-(cappedZoom - 1) * height) - offset.x;
@Ell
Ell / ImageEditor.carbide.md
Last active August 26, 2016 21:35
ImageEditor
@Ell
Ell / untitled.carbide.md
Last active August 26, 2016 21:19
untitled
package server
import (
"errors"
"github.com/ell/tunes/mopidy"
"golang.org/x/net/context"
"log"
"net/http"
)
package server
import (
"encoding/json"
"golang.org/x/net/context"
"net/http"
)
// ContextHandler interface wrapper for ServeHTTPContext
type ContextHandler interface {
router.Handle("/add", &ContextAdapter{
ctx: rootContext,
handler: withAPIKeyAuthentication(cfg.Server.APIKey, withDatabase(db, withMopidyClient(mclient, ContextHandlerFunc(addSongHandler)))),
}).Methods("POST")