Skip to content

Instantly share code, notes, and snippets.

@EmperorEarth
EmperorEarth / gist:4ded6b3f29555dac5c94
Created January 23, 2016 18:54 — forked from Zirak/gist:3086939
xhr for dummies

So, you want to send a motherfucking XMLHttpRequest (XHR, or commonly and falsly known as AJAX.) Too bad, just ran out of motherfucking XMLHttpRequests; but I still have one regular. XHR is not magic. It does not autofuckinmagically send things the way you want them do be sent. It does not do the thinking for you. It just sends an Http Request.

You get a hold on such a prime beast like this:

@EmperorEarth
EmperorEarth / gist:d9a711e3f4e6f225ffee
Created January 30, 2016 22:06
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@EmperorEarth
EmperorEarth / builder.go
Created February 9, 2016 21:48 — forked from vaskoz/builder.go
Golang Builder pattern
package main
import "strconv"
import "fmt"
type Color string
type Make string
type Model string
const (
@EmperorEarth
EmperorEarth / what-forces-layout.md
Created February 10, 2016 04:11 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@EmperorEarth
EmperorEarth / nginxondigitalcoean.sh
Created February 16, 2016 09:40 — forked from AlexZeitler/nginxondigitalcoean.sh
DigitalOcean snippets
sudo apt-get update
sudo apt-get install nginx
#default website
/** @jsx React.DOM */
'use strict';
var React = require("react/addons");
var _ = require("lodash");
var $ = require("jquery");
var AtomReact = require("atom-react");
var classNames = require('classnames');
.
├── actions
├── stores
├── views
│   ├── Anonymous
│   │   ├── __tests__
│   │   ├── views
│   │   │   ├── Home
│   │   │   │   ├── __tests__
│   │   │   │   └── Handler.js
@EmperorEarth
EmperorEarth / README.md
Created February 19, 2016 00:45 — forked from miku/README.md
git --track vs --set-upstream vs --set-upstream-to

README

Short excursion into git --track, --set-upstream and --set-upstream-to.

All examples use the aliases co for checkout and br for branch.

Setup:

$ git clone [email protected]:AKSW/OntoWiki.git

@EmperorEarth
EmperorEarth / database.go
Last active August 3, 2016 06:01 — forked from sogko/database.go
hello-world-relay-part-1 - In-memory database
package data
// Data model structs
type Post struct {
Id string `json:"id"`
Text string `json:"text"`
}
// Mock data
var latestPost = &Post{
@EmperorEarth
EmperorEarth / schema.go
Last active August 3, 2016 06:12 — forked from sogko/schema.go
hello-world-relay-part-2 - Schema definition (golang)
package data
import (
"github.com/graphql-go/graphql"
"github.com/graphql-go/relay"
)
var postType *graphql.Object
var queryType *graphql.Object
var Schema graphql.Schema