Skip to content

Instantly share code, notes, and snippets.

View khadorkin's full-sized avatar

Dima Khadorkin khadorkin

  • Mobile Roadie
  • Vilnius, Lithuania
  • 18:37 (UTC +03:00)
View GitHub Profile
/*
* message - сообщение, которое будет опубликовано
* image - картинка для постинга
* user_id - id текущего пользователя (к нему будет осуществлён постинг)
*/
function wallPost(message, image, user_id) {
VK.api('photos.getWallUploadServer', {
uid: user_id
}, function (data) {
if (data.response) {
/*
A little node.js server for testing html5 ajax file uploads.
It serves up the current directory and receives uploads at /upload.
This is for use with xhr.send(file) where the entire request body is the file.
It just pauses one second between chunks so that client-side progress events
get a chance to fire. On my laptop it looks like the maximum chunk size is
around 40K, so you would still need images in the range of hundreds of kilobytes
to really be able to test it.
module.exports = function urlFetch(urlString, callback) {
var url = require('url').parse(urlString);
var module = url.protocol === 'https:' ? require('https') : require('http');
require('http').get({
host: url.hostname,
port: url.port,
path: url.path
}, function(res) {
var body = '';
res.on('data', function(chunk) {
// For node-mongodb-native (npm install mongodb)
var mongodb = require('mongodb');
var MongoTransaction = function(db) {
this.db = db;
this.queue = [];
this.running = false;
this.failureFn = function(){};
}
<html xmlns:fb="http://ogp.me/ns/fb#">
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# oghowto: http://ogp.me/ns/fb/oghowto#">
<title>OG Tutorial App</title>
<meta property="fb:app_id" content="256521937796214" />
<meta property="og:type" content="oghowto:demo" />
<meta property="og:title" content="Open Graph HowTo" />
<meta property="og:image" content="http://placehold.it/200x200" />
<meta property="og:description" content="Minimum requirements to get Open Graph objects and actions working" />
<meta property="og:url" content="http://oghowto.herokuapp.com/test.html">
<style type="text/css">
@texty-inputs: ~'input[type="text"], input[type="password"], input[type="email"], input[type="url"], input[type="date"], input[type="month"], input[type="time"], input[type="datetime"], input[type="datetime-local"], input[type="week"], input[type="number"], input[type="search"], input[type="tel"], input[type="color"]';
.pure-form {
@{texty-inputs} {
display: block;
}
}
// yields
(function(d, s) {
var deps = {
twitter: [
"//platform.twitter.com/widgets.js",
"twitter-wjs"
],
facebook: [
"//connect.facebook.net/en_US/all.js#xfbml=1",
"facebook-jssdk"
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<div id="testee">foo</div>
<script type="text/javascript">
document.getElementById('testee').oncontextmenu = function(e) {
alert('e.clientX: ' + e.clientX + '; e.clientY: ' + e.clientY +
@khadorkin
khadorkin / c.md
Last active August 29, 2015 14:18 — forked from SerafimArts/tips.md
  • На iOS устройствах числовые значения подчёркиваются синим. Эта проблема возникает из-за того, что iOS устройства по умолчанию считают все числа похожие на телефонные номера - телефонными номерами. Решается добавлением <meta name="format-detection" content="telephone=no" /> Тоже самое касается адреса: <meta name="format-detection" content="address=no" />

  • Пользователь может уменьшать и увеличивать приложение. Решается добавляением тега <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />

  • Ссылки нажимаются с задержкой (примерно 300ms). Решается подпиской на событие touchstart и принудительной инициализацией события click после него. Если проблема всё равно возникает - ничего не поделать, надо облегчать dom.

  • В android появляется синяя обводка вокруг ссылок с характерным звуком. Решение:

As I've been learning more and more about NativeScript, one of the first tasks I really dove into was learning how to customize the Navigation Bar for an iOS app. NativeScript has a Navbar component on the roadmap, but for now, it requires some knowledge about the underlying iOS implementation of UINavigationControllers, UIViewControllers and the like.  But fear not!  I have braved the treacherous waters of StackOverflow and the Objective-C docs and emerged, victorious and unscathed.

1

In this article, I’ll go over a few of the more common tweaks that you might be needing to make to the Navigation Bar or Status Bar. While NativeScript is a cross-platform framework, these tweaks apply specifically to iOS. However, most of the items that I will