Skip to content

Instantly share code, notes, and snippets.

@jmw511
jmw511 / gist:9548448
Created March 14, 2014 14:13
SimpleAdding
var SimpleAdding = function(num){
var total = 0
for (var i = 1; i<= num; i++){
total = total + i;
console.log(total);
}
};
SimpleAdding(6);
@jmw511
jmw511 / about.html
Created March 27, 2014 01:21
Website
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> Jessica Weinberg</title>
<link rel="stylesheet" href="css/normalize.css">
<link href='http://fonts.googleapis.com/css?family=Quintessential' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/main.css">
<style>
nav a {
@jmw511
jmw511 / gist:4827aac455e183ead09c
Created January 6, 2015 19:06
GetContentInBatches function
func (api GraphV2) GetContentInBatches(path string, since, until int64, fields ...string) ([]BatchResponse, error) {
url := fmt.Sprintf("%v/%v?fields=id&since=%v&until=%v&limit=%v&access_token=%v", HostV2, path, since, until, BatchLimit, api.AccessToken)
ids := []string{}
for {
resp, err := GetFacebookGraphRequest(url)
if err != nil {
return nil, err
}
@jmw511
jmw511 / gist:5e4d932f4e2b68563daf
Created January 6, 2015 19:32
FacebookGraphResponse
type FacebookGraphResponse struct {
Data []GraphResponseData `json:"data"`
Error Error `json:"error_msg"`
ErrorMessage string `json:"error_msg"` // If a serious problem occurs facebook will return a different format of error message
ErrorCode int `json:"error_code"`
Paging struct {
Cursors struct {
Before string `json:"before"`
After string `json:"after"`
} `json:"cursors"`
@jmw511
jmw511 / gist:d0feb500ce0a57b8d17c
Created January 6, 2015 20:40
PostGraphRequests function
func (api GraphV2) PostGraphRequests(urls []string) ([]BatchResponse, error) {
batchCh := make(chan []BatchResponse)
errs := make(chan error)
responses := []BatchResponse{}
var wg sync.WaitGroup
for _, url := range urls {
wg.Add(1)
go func(url string) {
defer wg.Done()
@jmw511
jmw511 / gist:712ac0bb4ce6d07ff605
Created April 15, 2015 22:55
Script to reimport errybody
package main
import (
"encoding/csv"
"fmt"
"io"
"os"
"strconv"
"time"
package main
import (
"encoding/csv"
"fmt"
"io"
"os"
"strconv"
"time"