Skip to content

Instantly share code, notes, and snippets.

View eyeezzi's full-sized avatar

Uzziah Eyee eyeezzi

View GitHub Profile
@eyeezzi
eyeezzi / gist:e44491e1a62873e96f92
Last active August 29, 2015 14:26 — forked from alexmingoia/gist:4db967e5aeb31d84847c
Beyond Angular and Backbone with Undirectional apps

Beyond Angular and Backbone with Unidirectional apps

What is a unidirectional app?

Unidirectional is a term coined by React engineers to describe the data flow of an application. Unidirectional apps employ functional reactive programming techniques such as immutability, purity, and most importantly unidirectional (as opposed to bidirectional) data flow.

A unidirectional app is defined by no mutable references no two-way references between concerns.

Unidirectional app flowchart

@eyeezzi
eyeezzi / 0_reuse_code.js
Created September 20, 2016 21:45
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@eyeezzi
eyeezzi / swift_tasks
Last active September 20, 2016 21:53
// how to set status bar style for a view controller (not embedded in navController
override func preferredStatusBarStyle() -> UIStatusBarStyle {
// also set "view controller-based status bar style" to YES in Info.plist
return UIStatusBarStyle.LightContent
}
// setting apperance proxy for a UIControl
UISwitch.appearanceWhenContainedInInstancesOfClasses([CustomTableViewController.self]).thumbTintColor = UIColor.brownColor()
@eyeezzi
eyeezzi / Elasticsearch_operations.json
Created December 6, 2016 02:27
Some operations on Elasticsearch using the Kibana Console query DSL
# the recommended way to do complex queries.
GET /firebase/event/_search
{
"query": {
"bool": {
"must": [
{ "multi_match": {
"query": "pride parade",
"fields": ["title", "description"]
}}
@eyeezzi
eyeezzi / autoHeightTableViewCell.swift
Last active January 9, 2017 23:29
UITableViewCell with automatic height using autolayout
/*
Ensure the cell has complete constraints from top to bottom, i.e all the subviews of the cell's contentView should have unambigous constraints from top to bottom.
*/
/* For UITableViews with Prototype cells */
// in viewDidLoad
self.tableView.rowHeight = UITableViewAutomaticDimension
self.tableView.estimatedRowHeight = 150 // an arbitrary number for estimation
@eyeezzi
eyeezzi / read_generic_json.go
Last active January 3, 2018 03:37
How to Read Generic JSON in Golang.
package main
import (
"encoding/json"
"fmt"
)
func main() {
// Go stores JSON data as an array of bytes.
@eyeezzi
eyeezzi / read_known_json.go
Last active January 3, 2018 03:53
How to read JSON data that matches a struct in Go.
package main
import (
"encoding/json"
"fmt"
)
type User struct {
Fname string
Lname string
package main
import (
"encoding/json"
"fmt"
)
type User struct {
Fname string
Mname *string
@eyeezzi
eyeezzi / read_json_in_http.go
Last active February 21, 2018 14:06
Alternative way to read JSON body using ioutil.ReadAll()
func CreateNote(w http.ResponseWriter, r *http.Request) {
var m map[string]interface{}
body, err := ioutil.ReadAll(r.Body)
if err = json.Unmarshal(body, &m); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
@eyeezzi
eyeezzi / curl.md
Created January 3, 2018 19:04 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.