Skip to content

Instantly share code, notes, and snippets.

@ptmt
ptmt / ci-configure.yml
Last active Aug 29, 2015
Ansible playbook for install jenkins + mongo on docker
View ci-configure.yml
- hosts: ci
sudo: yes
tasks:
- name: Install Docker on Ubuntu
apt: pkg=docker.io state=present
- name: Rename docker.io to docker
shell: ln -sf /usr/bin/docker.io /usr/local/bin/docker
@ptmt
ptmt / index.ios.js
Created Jul 20, 2015
0.8.0rc2 - rounded View issue
View index.ios.js
/* @flow */
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
View,
Animated
} = React;
@ptmt
ptmt / Utils.m
Created Aug 16, 2015
Taking screenshot on react-native
View Utils.m
- (NSURL *) takeScreenshot:(NSString *)imageName {
UIViewController *root = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
UIGraphicsBeginImageContextWithOptions(root.view.bounds.size, NO, [UIScreen mainScreen].scale);
[root.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
NSData *imgData = UIImagePNGRepresentation(image);
UIGraphicsEndImageContext();
@ptmt
ptmt / tokenizer_tests.fs
Created Apr 3, 2012
simple fsharp tests
View tokenizer_tests.fs
module totify.tests
open NUnit.Framework
open FsUnit
open TinyNLP
let shouldBeTrue a =
Assert.AreEqual(a, true)
[<Test>]
@ptmt
ptmt / flamp.fix.user.js
Created May 10, 2012
flamp.fix.user.js
View flamp.fix.user.js
// ==UserScript==
// @name flamp_fix
// @description save entire textarea in localStorage
// @version 0.1.0
// @namespace http://potomushto.com
// @include http://*.flamp.ru/*
// @match http://*.flamp.ru/*
// ==/UserScript==
// http://userscripts.org/scripts/show/89824
@ptmt
ptmt / generate_assets.js
Last active Aug 24, 2016
node --harmony utils/generate_images.js
View generate_assets.js
'use strict';
const IMAGES_DIR = './images'
const ASSETS_DIR = './iOS/Images.xcassets'
const EXTENSIONS = ['jpg', 'jpeg', 'png']
var fs = require('fs')
var gm = require('gm')
function convertAndCopy(source, scaleFactor, imageName, imageExt) {
let per = scaleFactor === 3 ? '100%' : scaleFactor === 2 ? '50%' : '25%'
View REACTIVECONF2016-rnmacos.md

Proposal for lightning talk at Reactive Conference.

===

Use case for react-native-macos

React Native for macOS (a.k.a React Native Desktop) started as an experiment a year ago, just out of curiousity and the active stage of development also took place during the previous Reactive conference right in the hotel room in Bratislava.

5 minutes talk about why you probably haven't heard about any real desktop application based on RN, and for what kind of applications it might be perfect fit.

View ListViewExample.js
/**
* Copyright (c) 2013-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
@ptmt
ptmt / packages.config
Last active May 21, 2017
owin self-hosted blank project in F#
View packages.config
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Owin" version="1.1.0-beta2" targetFramework="net45" />
<package id="Microsoft.Owin.Hosting" version="1.1.0-beta2" targetFramework="net45" />
<package id="Owin" version="1.0" targetFramework="net45" />
<package id="Owin.Extensions" version="0.8.5" targetFramework="net45" />
<package id="Owin.Types" version="0.8.5" targetFramework="net45" />
</packages>
@ptmt
ptmt / rn-cli.config.js
Last active Aug 1, 2017
Symlinks workaround with wml
View rn-cli.config.js
const { execSync, spawn } = require('child_process');
if (process.argv.indexOf('start') > -1) {
console.log('Setting up wml');
const wmlBin = path.join(__dirname, 'node_modules/.bin/wml');
try {
console.log(execSync(`${wmlBin} rm all`).toString());
console.log(
execSync(
`${wmlBin} add ${__dirname}/../module ${__dirname}/node_modules/module --skip-prompt=true`