Skip to content

Instantly share code, notes, and snippets.

View smanurung's full-sized avatar
👋

Sonny Theo Tumbur Manurung smanurung

👋
View GitHub Profile
@gaearon
gaearon / modern_js.md
Last active April 14, 2025 19:22
Modern JavaScript in React Documentation

If you haven’t worked with JavaScript in the last few years, these three points should give you enough knowledge to feel comfortable reading the React documentation:

  • We define variables with let and const statements. For the purposes of the React documentation, you can consider them equivalent to var.
  • We use the class keyword to define JavaScript classes. There are two things worth remembering about them. Firstly, unlike with objects, you don't need to put commas between class method definitions. Secondly, unlike many other languages with classes, in JavaScript the value of this in a method [depends on how it is called](https://developer.mozilla.org/en-US/docs/Web/Jav
@ankurcha
ankurcha / AvroToBigQuery.java
Created October 23, 2015 05:29
Helper class to convert Apache Avro schema to BigQuery Table schema
package com.mallo64.dataflow
import com.google.api.client.json.GenericJson;
import com.google.api.services.bigquery.model.TableCell;
import com.google.api.services.bigquery.model.TableFieldSchema;
import com.google.api.services.bigquery.model.TableRow;
import com.google.api.services.bigquery.model.TableSchema;
import com.google.cloud.dataflow.sdk.transforms.DoFn;
import org.apache.avro.Schema;
import org.apache.avro.specific.SpecificRecord;
@technovangelist
technovangelist / http.go
Last active March 30, 2019 01:21
Trivial Expvar Sample Code
package main
import (
"expvar"
"github.com/paulbellamy/ratecounter"
"io"
"net/http"
"strconv"
"time"
)
@shrikeh
shrikeh / csrf-lua.conf
Created February 6, 2013 13:15
A simple nginx host file that, using the lua module, handles CSRF, rather than the backend having to (and thus generally breaking caching by having to use Set-Cookie). Here, the front end takes care of CSRF, and sends an X-CSRF-Valid header to the backend regarding the validity of the POST, so that it is advisory (the backend then choose whether…
server {
listen 80;
root /root/to/your/docroot;
proxy_redirect off;
proxy_intercept_errors on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;