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
function doubleNum(num) { | |
var | |
numStr = num + '', | |
numLen = numStr.length; | |
if (!(numLen%2)) { | |
var | |
first = numStr.substring(0, numLen/2), | |
second = numStr.substring(numLen/2); |
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
const http = require('http'); | |
const Firebase = require('firebase'); | |
const FB_ROOT = new Firebase('https://scrapyard.firebaseio.com/'); | |
const VK = { | |
wallGet: { | |
// translating vk api to node http api | |
reqOpts: function(opts) { | |
return({ | |
host: 'api.vk.com', |
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
// Styling Chrome Console | |
function cons(styles) { | |
if (!cons.initial) cons.initial = console; | |
var defaultStyles = 'font-family: Arial; font-size: 2em;'; | |
styles = styles || defaultStyles; | |
console = { | |
log: function(str) { cons.initial.log('%c' + str, styles) } |
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
function getMedia(instaData, mediaCount, callback) { | |
var profileData = instaData.entry_data.ProfilePage[0]; | |
var userID = profileData.user.id; | |
var totalMedia = profileData.user.media.count; | |
var mediaCount = mediaCount > totalMedia ? totalMedia : mediaCount; | |
var csrf_token = instaData.config.csrf_token; | |
var xhrBody = "ig_user(" + userID + ") { media.after(0, " + mediaCount + ") {nodes {display_src }}}"; | |
var xhr = new XMLHttpRequest(); | |
xhr.open("POST", '/query/', true) |
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
'use strict' | |
const http = require('http'); | |
const querystring = require('querystring'); | |
const VK = { | |
'groupId': { | |
name: 'groups.getById', | |
group_ids: 'boroda.land' | |
} |
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 INVITER = { | |
//chas: '53a8d957e483483cf5', // unique for specific account //lkleonov | |
chas: 'e796d178a8fd0c3cfb', // unique for specific account //laukye | |
message: 'Хей, привет! Меня зовут Алексей. В рамках проекта по объединению креативных людей Constellation, мы запустили кампанию по поиску единомышленников. Мы решили, что если ты вдруг тоже заинтересован в поисках оных, то у меня есть для тебя хорошая новость! Попутно мы можем помочь с поисками единомышленников тебе, если ты в них нуждаешься!\n\nРаботает это так: ставишь тег #constellate на стене (или где-нибудь, чтобы тебя можно было найти через поиск) и рядом теги твоих увлечений, в чём ты, может, разбираешься, можешь свободно обсуждать и делиться опытом, творить что-то (ну, например, вот так: "#art #photography #dogbreeding #webdev #handmade #constellate"). И люди смогут потом находить по тегу #constellate тех, кто тоже находится в поисках и видеть, чем они увлекаются, чтобы завязать общение. Или, чтобы дать своим друзьям понять, о чём речь, можешь |
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
self.addEventListener('message', function(e) { | |
self.postMessage(e.data); | |
}, false); |
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
function xhr(xhrMethodName, appendedFunc) { | |
(function(xhrMethod) { | |
XMLHttpRequest.prototype[xhrMethodName] = function(data) { | |
appendedFunc(data); | |
xhrMethod.call(this.data); | |
}; | |
})(XMLHttpRequest.prototype[xhrMethodName]); | |
} | |
// xhr('send', function(d) {console.log(d)}); |
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
'use strict' | |
const http = require('http'); | |
const querystring = require('querystring'); | |
const PORT = 80; | |
http.createServer((servReq, servRes) => { | |
const postData = querystring.stringify({ |
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 xhr = new XMLHttpRequest(); | |
var body = 'act=load_idols&al=1&oid=50595075'; | |
xhr.open("POST", 'https://vk.com/al_fans.php', true) | |
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded') | |
xhr.onreadystatechange = function() { | |
if (this.readyState == 4 && this.status == 200) { | |
console.log(this.responseText) |
OlderNewer