Skip to content

Instantly share code, notes, and snippets.

View yrezgui's full-sized avatar

Yacine Rezgui yrezgui

View GitHub Profile
@yrezgui
yrezgui / AppDelegate.m
Last active August 29, 2015 14:26
React Native tutorial 1.6
// Open the file in Xcode and modify this line with the next one
jsCodeLocation = [NSURL URLWithString:@"http://localhost:8081/index.ios.bundle"];
// Your Mac needs to be in the same network as your device
jsCodeLocation = [NSURL URLWithString:@"http://ip-address-mac:8081/index.ios.bundle"];
@yrezgui
yrezgui / index.ios.js
Last active August 29, 2015 14:26
React Native tutorial 1.5
TouchableHighlight,
AlertIOS,
} = React;
...
onPress: function() {
AlertIOS.alert('hello');
},
@yrezgui
yrezgui / index.ios.js
Last active August 29, 2015 14:26
React Native tutorial 1.4
var MyProject = React.createClass({
onPress: function() {
console.log('hello');
},
...
<TouchableHighlight onPress={this.onPress}>
<Text style={styles.instructions}>
Touch
@yrezgui
yrezgui / index.ios.js
Last active August 29, 2015 14:26
React Native tutorial 1.3
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
View,
TouchableHighlight,
// If you're not used to this synxtax (ES6), you can still write ES5 code
@yrezgui
yrezgui / index.ios.js
Last active August 29, 2015 14:26
React Native tutorial 1.2
render: function() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<TouchableHighlight>
<Text style={styles.instructions}>
Touch
</Text>
@yrezgui
yrezgui / setup.sh
Last active August 29, 2015 14:26
React Native tutorial 1.1
nvm install iojs && nvm alias default iojs
brew install watchman
npm install -g react-native-cli
react-native init myproject
@yrezgui
yrezgui / co.js
Created June 23, 2015 19:02
Example of Generators using the "co" lib
var co = require('co');
var i = 0
function getPromiseTime() {
var t = ++i;
return new Promise(function (resolve, reject) {
setTimeout(function() {
console.log(t + ' released');
// First version
async function main() {
var result1 = await request( "http://some.url.1" );
var data = JSON.parse( result1 );
var result2 = await request( "http://some.url.2?id=" + data.id );
var resp = JSON.parse( result2 );
console.log( "The value you asked for: " + resp.value );
}
mkdir icon.iconset
sips -z 16 16 icon.png --out icon.iconset/icon_16x16.png
sips -z 32 32 icon.png --out icon.iconset/[email protected]
sips -z 32 32 icon.png --out icon.iconset/icon_32x32.png
sips -z 64 64 icon.png --out icon.iconset/[email protected]
sips -z 128 128 icon.png --out icon.iconset/icon_128x128.png
sips -z 256 256 icon.png --out icon.iconset/[email protected]
sips -z 256 256 icon.png --out icon.iconset/icon_256x256.png
sips -z 512 512 icon.png --out icon.iconset/[email protected]
@yrezgui
yrezgui / designer.html
Created October 29, 2014 23:26
designer
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;