Skip to content

Instantly share code, notes, and snippets.

View praveenaj's full-sized avatar

Praveena Sarathchandra praveenaj

View GitHub Profile
@mpyw
mpyw / Logger.js
Created August 14, 2018 17:46
Send your browser console errors to AWS CloudWatch. Inspired by https://github.com/agea/console-cloud-watch
import React, { Component } from 'react'
import CloudWatchLogs from 'aws-sdk/clients/cloudwatchlogs'
import Fingerprint2 from 'fingerprintjs2'
import StackTrace from 'stacktrace-js'
import { promisify } from 'es6-promisify'
export default class Logger {
events = []
originalConsole = null
@madcoda
madcoda / App.js
Created May 28, 2017 04:24
React-router v4 multi layout
import React, { Component } from 'react'
import { BrowserRouter as Router, Route, Link, Match, Redirect, Switch } from 'react-router-dom'
import OverviewPage from './page/OverviewPage'
import AccountPage from './page/AccountPage'
/*
Layouts, inline define here for demo purpose
you may want to define in another file instead
*/
@xaviervia
xaviervia / README.md
Last active February 16, 2021 20:12
Sketch 43 files JSON types
# 1. Install nginx
brew install nginx
# 2. Generate self-signed key/crt
openssl req -x509 -nodes -days 365 -newkey rsa:1024 \
-keyout /etc/ssl/private/myssl.key \
-out /etc/ssl/certs/myssl.crt
# 3. Edit nginx config located at: /usr/local/etc/nginx/nginx.conf
server {
@natchiketa
natchiketa / a Super-simple Nginx reverse proxy with Homebrew on OS X.md
Last active May 18, 2023 04:54
Super-simple Nginx reverse proxy with Homebrew on OS X

Installation

1)

brew install nginx
sudo cp /usr/local/Cellar/nginx/1.8.0/homebrew.mxcl.nginx.plist /Library/LaunchAgents

2)

Replace /usr/local/etc/nginx/nginx.conf with the nginx.conf in this gist. I'm using port 5000 for my current project. Obviously, change server_name as well, and probably the name of its access log.

@peterjmag
peterjmag / react-native-talk.md
Last active June 21, 2021 10:13
Let's build a React Native app in 20 minutes - React Berlin #1 (April 2015)
@danawoodman
danawoodman / 1-react-websockets-reflux.md
Last active September 15, 2021 14:48
Using WebSockets with Reflux and React

WebSockets + Reflux + React

Using WebSockets, React and Reflux together can be a beautiful thing, but the intial setup can be a bit of a pain. The below examples attempt to offer one (arguably enjoyable) way to use these tools together.

Overview

This trifect works well if you think of things like so:

  1. Reflux Store: The store fetches, updates and persists data. A store can be a list of items or a single item. Most of the times you reach for this.state in react should instead live within stores. Stores can listen to other stores as well as to events being fired.
  2. Reflux Actions: Actions are triggered by components when the component wants to change the state of the store. A store listens to actions and can listen to more than one set of actions.
@mdunisch
mdunisch / How you get Sail.js running on Openshift.md
Last active July 13, 2023 14:51
Get Sails.js running on Openshift

#How you get Sail.js running on Openshift#

This instruction is tested with:

  • Sails.js v0.9.16
  • Node.js 0.10 on Openshift ( 05 May 2014)

###1) package.json

If you use the package.json build by sails new Projectname than you have to add a few fields for openshift – so the server can start you app automatically. Sails uses Grunt to build minify css/js and so on. Openshift dont have grunt installed so you have to add this also.

@ddbs
ddbs / export.php
Created March 14, 2014 10:15
wordpress: Exporting the results of a custom WPDB query to a downloaded CSV - http://imtheirwebguy.com/exporting-the-results-of-a-custom-wpdb-query-to-a-downloaded-csv/
$wpdb->show_errors();
global $wpdb;
// Grab any post values you sent with your submit function
$DownloadReportFrom = $_POST['ReportDateFrom'];
$DownloadReportTo = $_POST['ReportDateTo'];
// Build your query
@dlo
dlo / Auto-layout-keyboard-adjustment.md
Last active February 26, 2021 07:33
How to adjust a view's height with Auto Layout when a keyboard appears or disappears in iOS 7.

This gist outlines how to resize a view when a keyboard appears using Auto Layout (there are a bunch of code samples out there that manually adjust the view's frame, but that's just so 2013). The method I outline below works universally on both iPhone and iPad, portrait and landscape, and is pretty darn simple.

Setting Up

The first thing to do is to define our containing view controller, the view, and the bottom constraint that we'll use to adjust its size.

Here's HeightAdjustingViewController.h. We don't need to expose any public properties, so it's pretty bare.