Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kyle-ssg
kyle-ssg / BaseComponent
Last active August 29, 2015 14:15
BaseComponent for React with store listener handling
/** @jsx React.DOM */
module.exports = function (options) {
return React.createClass( _.assign({}, options, {
_listeners: [],
listenTo: function (store, event, callback) {
this._listeners.push({
store: store,
event: event,
@kyle-ssg
kyle-ssg / Chatify
Created July 22, 2015 15:11
Parse posts
this.content = Autolinker.link( content, {
replaceFn: function (autolinker, match) {
switch (match.getType()) {
case 'url' :
if (match.url.match(/\.(jpeg|jpg|gif|png)$/) != null) {
image = match.url;
if (image.indexOf('http') !=0) {
image = 'http://'+image;
}
} else if (Modernizr.video && match.url.match(/\.(mp4|webm)$/) != null) {
<View style={{flex:1}}>
<View style={{flex:1}}>
<Button><Text>Hi</Text></Button>
<ListItem><Text>Hi</Text></ListItem>
<Switch onChange={this.toggleState("switchVal")} value={this.state.switchVal}/>
<Checkbox onChange={this.toggleState("checkboxVal")} value={this.state.checkboxVal}/>
<Radio onChange={this.toggleState("radioVal")} value={this.state.radioVal}/>
<Loader/>
<TextInput
@kyle-ssg
kyle-ssg / auth-middleware.js
Created October 10, 2016 18:48
Treat any API call with Auth header the same as a call with username/password body
const jwt = require('jsonwebtoken');
const privateKey = 'secret';
module.exports = function (req, res, next) {
const oldSend = res.json;
const token = req.headers.authorization;
var body = req.body;
//When returning json from a username+password request, return a signed token
***0. Firebase***
This application requires you to have firebase setup, from there you specify at what location you want to store chat
```
import FireChat from '../fire-chat';
const chat = new Firechat(db.ref("chat"));
```
***1. Register events***

0. Firebase

This application requires you to have firebase setup, from there you specify at what location you want to store chat

    import FireChat from '../fire-chat';
    const chat = new Firechat(db.ref("chat"));

1. Register events

@kyle-ssg
kyle-ssg / loadMore
Created November 27, 2016 11:37
Firebase paging
var loadMore = (ref, from, qty, reverse=false)=> {
var direction = reverse ? 'endAt' : 'startAt';
return ref['direction'](null,from)
.limitToFirst(qty+1)
.once('value')
.then((snap)=>{
var items = snap.val() || {};
var res = {hasMore:false, items};
delete items[from];
res.hasMore = Object.keys(items).length == qty;
@kyle-ssg
kyle-ssg / Animation
Created February 20, 2017 10:17
animates opacity on press
const Animation = class extends Component {
displayName: 'Animation'
constructor (props, context) {
super(props, context);
this.state = { opacity: 1 };
}
toggleFade = () => {
//toggle opacity

Contributing

We're always looking to improve this project, open source contribution is encouraged so long as they adhere to our guidelines.

Pull Requests

The Solid State team will be monitoring for pull requests. When we get one, a member of team will test the work against our internal uses and sign off on the changes. From here, we'll either merge the pull request or provide feedback suggesting the next steps.

A couple things to keep in mind:

  • If you've changed APIs, update the documentation.
Set salt
- When
1: when the user logs in
2: When the user changes their secret word
- Process
This is the process of storeing the encrypted secret answer along with a salt.
At this point the previous secured local storage is wiped, storeing a combination of the secret word and salt along with a generated challenge.
If there is local storage data in memory at this point it is re-encrypted using the generated challenge and written to local storage.