- Part 1: An Intro to Functional Programming Concepts in JavaScript
- Part 2: An Intro to Functional Programming Concepts in JavaScript
- Part 3: An Intro to Functional Programming Concepts in JavaScript
- Dipping into wu.js: autoCurry
- Haskell in ES6: Part 1
- [Haskell in ES6: Part 2](http://casualjavascript.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var CryptoJS = require('crypto-js'); | |
| function uploadImage(uri) { | |
| let timestamp = (Date.now() / 1000 | 0).toString(); | |
| let api_key = 'your api key' | |
| let api_secret = 'your api secret' | |
| let cloud = 'your cloud name' | |
| let hash_string = 'timestamp=' + timestamp + api_secret | |
| let signature = CryptoJS.SHA1(hash_string).toString(); | |
| let upload_url = 'https://api.cloudinary.com/v1_1/' + cloud + '/image/upload' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| import { View, StatusBar, ListView, RefreshControl } from 'react-native'; | |
| import { connect } from 'react-redux'; | |
| import { | |
| Header, | |
| Container, | |
| Content, | |
| Title, | |
| Button, | |
| Icon, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| import { | |
| AppRegistry, | |
| StyleSheet, | |
| Text, | |
| View, | |
| ListView, | |
| RefreshControl | |
| } from 'react-native'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| updateRenderModel(contentOffset) { | |
| var listItemHeight = ITEM_SIZE; | |
| // Use contentOffset to calculate first visible dataItem as y-position / height of item | |
| var firstVisibleItem = Math.max(0, Math.floor(contentOffset.y / listItemHeight)); | |
| var renderModelSize = BUFFER_ITEMS * 2 + DISPLAY_ITEMS; | |
| // Calculate first y-position | |
| var nextPosition = (firstVisibleItem - BUFFER_ITEMS) * listItemHeight; | |
| // Subset of dataModel to be rendered. | |
| var dataItems = this.state.dataModel.slice(firstVisibleItem, firstVisibleItem + renderModelSize); | |
| var newRenderModel = dataItems.map((dataItem, index) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <script src="https://www.gstatic.com/firebasejs/3.0.0/firebase.js"></script> | |
| <title>ZeroToApp</title> | |
| <style> | |
| #messages { width: 40em; border: 1px solid grey; min-height: 20em; } | |
| #messages img { max-width: 240px; max-height: 160px; display: block; } | |
| #header { position: fixed; top: 0; background-color: white; } | |
| .push { margin-bottom: 2em; } | |
| @keyframes yellow-fade { 0% {background: #f2f2b8;} 100% {background: none;} } |
- Part 1: An Intro to Functional Programming Concepts in JavaScript
- Part 2: An Intro to Functional Programming Concepts in JavaScript
- Part 3: An Intro to Functional Programming Concepts in JavaScript
- Dipping into wu.js: autoCurry
- Haskell in ES6: Part 1
- [Haskell in ES6: Part 2](http://casualjavascript.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** @jsx React.DOM */ | |
| var LopMonHoc = React.createClass({ | |
| getInitialState: function(){ | |
| return {data: []} | |
| }, | |
| loadData: function(){ | |
| $.ajax({ | |
| url: '/daotao/lops', | |
| success: function(data){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, {PropTypes} from 'react'; | |
| import axios from 'axios'; | |
| /** | |
| * @usage | |
| * const InfinitePostsView = makeInfinite('/posts')(PostsView); | |
| */ | |
| const infinitePropType = PropTypes.shape({ | |
| data: PropTypes.array.isRequired, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Using Operator Mono in Atom | |
| * | |
| * 1. Open up Atom Preferences. | |
| * 2. Click the “Open Config Folder” button. | |
| * 3. In the new window’s tree view on the left you should see a file called “styles.less”. Open that up. | |
| * 4. Copy and paste the CSS below into that file. As long as you have Operator Mono SSm installed you should be golden! | |
| * 5. Tweak away. | |
| * | |
| * Theme from the screenshot (http://cdn.typography.com/assets/images/blog/operator_ide2.png): |