Skip to content

Instantly share code, notes, and snippets.

@andyburke
andyburke / facebook-photo-post-javascript.js
Created December 19, 2011 20:37
How to post a photo to Facebook from client-side Javascript
// This bit is important. It detects/adds XMLHttpRequest.sendAsBinary. Without this
// you cannot send image data as part of a multipart/form-data encoded request from
// Javascript. This implementation depends on Uint8Array, so if the browser doesn't
// support either XMLHttpRequest.sendAsBinary or Uint8Array, then you will need to
// find yet another way to implement this. (This is left as an exercise for the reader,
// but if you do it, please let me know and I'll integrate it.)
// from: http://stackoverflow.com/a/5303242/945521
if ( XMLHttpRequest.prototype.sendAsBinary === undefined ) {
@ghinda
ghinda / object-to-form-data.js
Last active September 17, 2024 05:22
JavaScript Object to FormData, with support for nested objects, arrays and File objects. Includes Angular.js usage.
// takes a {} object and returns a FormData object
var objectToFormData = function(obj, form, namespace) {
var fd = form || new FormData();
var formKey;
for(var property in obj) {
if(obj.hasOwnProperty(property)) {
if(namespace) {
@deminoth
deminoth / gist:6df889c0d5e35b9f4b54
Last active April 1, 2021 14:18
카카오 자바스크립트 SDK 비동기로드 asynchronously load Kakao Javascript SDK
window.kakaoAsyncInit = function() {
Kakao.init('your-javascript-key');
};
(function(d, s, id){
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "https://developers.kakao.com/sdk/js/kakao.min.js";
var done = false;
js.onload = js.onreadystatechange = function() {
@takp
takp / file0.txt
Last active April 13, 2016 08:55
AWS Elastic Beanstalk、Nginx + Passenger (standalone)の環境設定 ref: http://qiita.com/tak_nishida/items/cf30a2d373744943b943
$ passenger start --nginx-config-template nginx.conf.erb