Skip to content

Instantly share code, notes, and snippets.

View SevInf's full-sized avatar

Serhii Tatarintsev SevInf

  • Berlin
  • 14:02 (UTC +02:00)
View GitHub Profile
@SevInf
SevInf / gist:1388323
Created November 23, 2011 10:04
RelativeLayout example
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical" >
<TextView
android:id="@+id/first"
android:text="1"
android:layout_centerHorizontal="true"
@SevInf
SevInf / RestKit.podspec
Created January 26, 2012 10:35
RestKit 0.9.4-dev podspec
Pod::Spec.new do |s|
s.name = 'RestKit'
s.version = '0.9.4'
s.summary = 'RestKit is a framework for consuming and modeling RESTful web resources on iOS and OS X.'
s.homepage = 'http://www.restkit.org'
s.author = { 'Blake Watters' => '[email protected]' }
s.source = { :git => 'https://github.com/RestKit/RestKit', :commit=>'c19a500ca8145295e0a518019c036e585dc42094' }
# It has no source_files itself, so the resolver should not allow dependencies on this spec unless it’s a `part_of' type dependency
@SevInf
SevInf / gist:7010893
Last active December 25, 2015 17:09
test for APW
var assert = require('assert'),
Q = require('Q'),
APW = require('./index.js');
var defers = ['A', 'B', 'C*', 'D*', 'E*', 'F*', 'G*'].reduce(function (res, key) {
res[key] = Q.defer();
return res;
}, {});
function createNode(id, run) {
rootUrl: http://localhost:8080
gridUrl: http://localhost:4444/wd/hub
browsers:
- phantomjs
#!/bin/bash
# Setup and start Sauce Connect for your TravisCI build
# This script requires your .travis.yml to include the following two private env variables:
# SAUCE_USERNAME
# SAUCE_ACCESS_KEY
# Follow the steps at https://saucelabs.com/opensource/travis to set that up.
#
# Curl and run this script as part of your .travis.yml before_script section:
# before_script:
#!/bin/bash
if [ -z "${SAUCE_USERNAME}" ] || [ -z "${SAUCE_ACCESS_KEY}" ]; then
echo "This script can't run without your Sauce credentials"
echo "Please set SAUCE_USERNAME and SAUCE_ACCESS_KEY env variables"
echo "export SAUCE_USERNAME=ur-username"
echo "export SAUCE_ACCESS_KEY=ur-access-key"
exit 1
fi
SAUCE_TMP_DIR="$(mktemp -d -t sc.XXXX)"
@SevInf
SevInf / gist:09a1e7d913fa46d13265
Last active August 29, 2015 14:21
Promises + generators
async(function*() {
console.log('start');
yield asyncFunction();
var value = yield asyncFunction();
console.log('value', value);
});
function asyncFunction() {
return new Promise((resolve, reject) => {
setTimeout(() => {

Keybase proof

I hereby claim:

  • I am SevInf on github.
  • I am sevinf (https://keybase.io/sevinf) on keybase.
  • I have a public key whose fingerprint is E483 737C 2AE2 4426 C2BC FCFC B89D 6839 8645 615E

To claim this, I am signing this object:

@SevInf
SevInf / codemod.js
Created September 30, 2016 13:20
Codemod to migrate from Q to Bluebird
const replacements = {
'thenResolve': 'thenReturn',
'thenReject': 'thenThrow',
'fcall': 'try'
}
export default function transformer(file, api) {
const j = api.jscodeshift;
const sourceCalls = [];
const f = j(file.source);
@SevInf
SevInf / hot-reload.js
Last active August 28, 2018 17:40
Webpack hot reloading example
import { text } from './text.mjs';
document.body.textContent = text;
module.hot && module.hot.accept('./text.mjs', () => {
// here text.mjs is updated and text variable has a new value
document.body.textContent = text;
})