Skip to content

Instantly share code, notes, and snippets.

View andrew-aladev's full-sized avatar
🐻

Andrew Aladjev andrew-aladev

🐻
View GitHub Profile
@andrew-aladev
andrew-aladev / cors-nginx.conf
Created October 30, 2012 08:39
Wide-open CORS config for nginx with polldaddy
#
# Wide-open CORS config for nginx
#
location /polldaddy {
proxy_pass https://api.polldaddy.com/;
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
@andrew-aladev
andrew-aladev / example
Created November 19, 2012 14:31
facebook image share
if (XMLHttpRequest.prototype.sendAsBinary === undefined) {
XMLHttpRequest.prototype.sendAsBinary = function(string) {
var bytes = Array.prototype.map.call(string, function(c) {
return c.charCodeAt(0) & 0xff;
});
this.send(new Uint8Array(bytes).buffer);
};
}
FB.PostImage = function(authToken, data, message) {
@andrew-aladev
andrew-aladev / package.json
Created November 21, 2012 09:52
share picture with twitter and flickr
{
"name": "oauth-shares",
"description": "oauth twitter and flickr shares integration",
"version": "0.0.1",
"private": true,
"dependencies": {
"express": "3.x",
"oauth": "0.9.x"
}
}
@andrew-aladev
andrew-aladev / config.ru
Created November 22, 2012 12:17
twitter flickr share picture
require "./share"
run Share.new
@andrew-aladev
andrew-aladev / index.html
Created November 27, 2012 20:44
proper twitter callback
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="https://platform.twitter.com/widgets.js"></script>
</head>
<body>
<script>
$(document).ready(function() {
var url = "https://twitter.com/intent/tweet?" + $.param({
--- a/libtransmission/peer-mgr.c 2013-06-30 22:58:23.208920486 +0300
+++ b/libtransmission/peer-mgr.c 2013-06-30 23:07:26.238865338 +0300
@@ -1003,6 +1003,27 @@
return 0;
}
+static int
+comparePieceForSequential ( const void * va, const void * vb )
+{
+ const struct weighted_piece * a = va;
(function(undefined) {
"use strict";
var COMMON_URL = "/combres.axd/angular_common_templates/1";
var get_promise = function (url, $http, $injector) {
return $http.get(url).then(function(response) {
$injector.get("$compile")(response.data);
return response;
});
@andrew-aladev
andrew-aladev / knockout.templates.js
Created June 19, 2014 16:58
Knockout asynchronous templates
(function(undefined) {
"use strict";
if (!ko.templates) {
ko.templates = {};
}
if (!ko.templates_data) {
ko.templates_data = {};
}
(function($, undefined) {
"use strict";
if (!ko.templates) {
ko.templates = {};
}
var StringTemplateSource = function(string) {
this.string = string;
}
var infowindow = new google.maps.InfoWindow({
content : "<div></div>"
});
(function (item, item_is_work_order, item_is_task, marker, infowindow) {
google.maps.event.addListener(infowindow, "domready", function () {
var wrapper_el = $(this.k.contentNode).closest(".gm-style-iw").parent()
.empty().css({
width : "",
height : "",
cursor : ""