Skip to content

Instantly share code, notes, and snippets.

View JRGould's full-sized avatar
🤦

Jeff Gould JRGould

🤦
View GitHub Profile
@JRGould
JRGould / index.ios.js
Last active August 29, 2015 14:25
Deep Thoughts React-Native App v 0.2
/**
* DeepThoughts App v 0.2
*/
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
@JRGould
JRGould / index.ios.js
Last active August 31, 2015 16:13
Deep Thoughts React Native App v 0.3
/**
* DeepThoughts App v 0.3
*/
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
@JRGould
JRGould / app.js
Last active November 26, 2015 05:09
Give it a REST js using mock data
var posts_mockup = [
{ ID: 1, title: "First Post Title", permalink: 'http://example.com/1/', upvotes: 12, downvotes: 2 },
{ ID: 22, title: "Second Post Title", permalink: 'http://example.com/2/', upvotes: 1, downvotes: 22 },
{ ID: 33, title: "Third Post Title", permalink: 'http://example.com/3/', upvotes: 5, downvotes: 4 },
{ ID: 44, title: "Fourth Post Title", permalink: 'http://example.com/4/', upvotes: 2, downvotes: 2 },
{ ID: 55, title: "Fifth Post Title", permalink: 'http://example.com/5/', upvotes: 8, downvotes: 13 },
];
var $el;
var posts = {};
@JRGould
JRGould / app.js
Created November 26, 2015 05:15
Give it a REST app using data from give-it-a-rest.dev
var giar_settings = {
api_base: 'http://give-it-a-rest.dev/wp-json/give-it-a-rest/v1/',
endpoints: {
posts: { route: 'list-posts/', method: 'GET' },
vote: { route: 'vote/', method: 'POST' }
}
}
var $el;
var posts = {};
@JRGould
JRGould / index.html
Created November 26, 2015 02:16
Give it a rest html
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Give it a REST</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<script src="app.js"></script>
<style>
@JRGould
JRGould / give-it-a-rest-plugin.php
Last active August 2, 2016 14:45
Give it a REST WordPress plugin component
<?php
/*
Plugin Name: Give It A REST API Plugin
Plugin URI: http://deliciousbrains.com/blog
Description: Enables the Give it a REST API
Author: Jeff Gould
Version: 0.1
Author URI: http://deliciousbrains.com
*/
<?php
/*
Plugin Name: WPMDB - Fix cURL Expect Header
Plugin URI: https://gist.github.com/JRGould/bd4e23a40111f5f3cd69b6913e05de00/
Description: Preempts automatic inclusion of "Expect: 100-continue" header by cURL which can cause null response from remote site, resulting in "cURL Error 52: Empty reply from server."
Author: Delicious Brains
Author URI: http://deliciousbrains.com
Version: 0.1
Network: True
*/
@JRGould
JRGould / SharedDataSingleton.swift
Last active April 19, 2017 15:05
Swift shared data singleton with data persistence and simple callback support
/**
Usage: var mySharedData = SharedData.instance
*/
class SharedData {
static let instance: SharedData = {
let instance = SharedData()
// Update instance.defaultsName if desired
if let defaults = NSUserDefaults.standardUserDefaults().objectForKey(instance.defaultsName) as? [String:AnyObject] {
@JRGould
JRGould / index.ios.js
Last active May 24, 2017 07:46
DeepThoughts React-Native App Starter Template
/**
* DeepThoughts Template
*/
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
@JRGould
JRGould / index.ios.js
Last active May 24, 2017 07:46
Deep Thoughts React-Native App v 0.1
/**
* DeepThoughts App v 0.1
*/
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,