Skip to content

Instantly share code, notes, and snippets.

View jokull's full-sized avatar
☺️

Jökull Sólberg Auðunsson jokull

☺️
View GitHub Profile
let Thing = (props) => (
<div>look {props.name}! no state!</div>
)
render(<Thing name="Ma"/>, el)
@jm3
jm3 / 7 Questions All Businesses Must Answer.md
Last active September 29, 2023 22:12
from Peter Thiel's book, Zero to One
pt Seven Questions All Businesses Must Answer
  1. The Engineering Question: Can you create breakthrough technology (vs. incremental improvement)?

  2. The Timing Question: Is now the right time to start this particular business?

  3. The Monopoly Question: Are you starting with a big share of a small market?

@denibertovic
denibertovic / Makefile
Last active January 12, 2016 21:10
Easily start a local Postgres instance for your development environment using docker
DATA_DIR="__data"
POSTGRES_VERSION=9.3
PORT=5432
.PHONY: docker-check postgres
docker-check:
@command -v docker >/dev/null 2>&1 || \
{ echo >&2 "Docker needs to be installed and on your PATH. Aborting."; exit 1; }
@coudron
coudron / view.py
Last active May 20, 2016 20:58
Python and Objective-C code that enables an iOS app to upload images directly to an S3 bucket using a secure authorization header generated by a python server Code is a Fork from Stackoverflow answer: http://stackoverflow.com/questions/4481311/architectural-and-design-question-about-uploading-photos-from-iphone-app-and-s3 Let me know what you th…
- (void)uploadImage:(UIImage *)image
{
//Set up the upload request from our server
NSURL *url = [NSURL URLWithString:@"http://<your-server-url-here>/"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
AFJSONRequestOperation *operation = [AFJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
// Pull out any required information out of the response
NSString *serverDate = [JSON valueForKeyPath:@"date_string"];
@ryandotsmith
ryandotsmith / hack-reactor.md
Last active November 24, 2022 07:01
Hack Reactor Talk

Tales From a Heroku User

Here are some things I have learned along the way.

Last Updated: 2013-02-08

Original Audience: Hack Reactor

About

{
"page":1,
"actions":{
"add":{
"url":"http://localhost:3000/events.json",
"method":"post",
"fields":{
"category_id":{
"type":"integer",
"length":null,
web: gunicorn -w4 -b0.0.0.0:$PORT app:app
@nijikokun
nijikokun / example-user.js
Created May 3, 2012 20:46
Beautiful Validation... Why have I never thought of this before?!
var user = {
validateCredentials: function (username, password) {
return (
(!(username += '') || username === '') ? { error: "No Username Given.", field: 'name' }
: (!(username += '') || password === '') ? { error: "No Password Given.", field: 'pass' }
: (username.length < 3) ? { error: "Username is less than 3 Characters.", field: 'name' }
: (password.length < 4) ? { error: "Password is less than 4 Characters.", field: 'pass' }
: (!/^([a-z0-9_-]+)$/i.test(username)) ? { error: "Username contains invalid characters.", field: 'name' }
: false
);
@ruckus
ruckus / gist:2293434
Created April 3, 2012 16:36
Basic setup of WAL-E for continuous archiving and recovery

WAL-E needs to be installed on all machines, masters and slaves.

How to install WAL-E

Only one machine, the master, writes WAL segments via continuous archiving. The configuration for the master postgresql.conf is:

archive_mode = on
archive_command = 'envdir /etc/wal-e.d/env wal-e wal-push %p'
archive_timeout = 60
if (typeof (AC) === "undefined") {
AC = {}
}
AC.ImageReplacer = Class.create({
_defaultOptions: {
listenToSwapView: true,
filenameRegex: /(.*)(\.[a-z]{3}($|#.*|\?.*))/i,
filenameInsert: "_☃x",
ignoreCheck: /(^http:\/\/movies\.apple\.com\/|\/105\/|\/global\/elements\/quicktime\/|_(([2-9]|[1-9][0-9]+)x|nohires)(\.[a-z]{3})($|#.*|\?.*))/i,
attribute: "data-hires",