Skip to content

Instantly share code, notes, and snippets.

@chrisbanes
chrisbanes / FloatLabelLayout.java
Last active March 15, 2024 06:39
FloatLabelLayout
/*
* Copyright 2014 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@rcknr
rcknr / DriveUpload.gs
Last active February 15, 2023 20:06
This is a sample code to upload a PDF file to Google Drive with OCR in Apps Script. uploadPdfOcr function returns a File object. To run the code provide a developer key for an API Console project with Drive API service enabled.
function uploadPdfOcr() {
authorize();
var key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // <-- developer key
var file = UrlFetchApp.fetch("http://somewhere.com/path/file.pdf").getBlob();
var metadata = { title: file.getName() }
var params = {method:"post",
oAuthServiceName: "drive",
oAuthUseToken: "always",
contentType: "application/pdf",
contentLength: file.getBytes().length,
@jrhames
jrhames / moment-holidays.js
Last active January 19, 2023 03:12
Holidays plugin for Moment.JS
//## Moment.JS Holiday Plugin
//
//Usage:
// Call .holiday() from any moment object. If date is a US Federal Holiday, name of the holiday will be returned.
// Otherwise, return nothing.
//
// Example:
// `moment('12/25/2013').holiday()` will return "Christmas Day"
//
//Holidays:
@mhawksey
mhawksey / gist:3007293
Created June 27, 2012 22:26
Turn Google Site pages into RSS feed
/*
Copyright 2011 Martin Hawksey
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
落書きの報告書 Twitterばかりしてる俺
超高速でビルドするけど 動かないVirtual Machine
やさしくないJavaの本ページ破りたい
Chromeの裏 2ちゃんを覗いて見つかれば逃げ場もない
座って固まり 目を伏せながら
心のひとつも解りあえないプログラムをにらむ
そして仲間たちは今夜辞職の計画をたてる
とにかくもう 会社や家には帰りたくない
自分の業務が何なのかさえ 解らず震えている
25の夜
@tbroyer
tbroyer / ActivityAsyncProxy.java
Created July 3, 2012 10:07
ActivityAsyncProxy
/*
* Copyright 2012 Thomas Broyer <t.broyer@ltgt.net>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@kimukou
kimukou / GDataOAuth2.groovy
Created February 25, 2012 09:04
GDataOAuth2.groovy
//
// ref https://gist.github.com/1899391
import java.io.*
import java.net.*
import groovy.transform.Field
//see @Field's Explanation http://d.hatena.ne.jp/uehaj/20110703/1309685397
@tbroyer
tbroyer / Html5Historian.java
Created February 22, 2012 10:07
GWT PlaceHistoryHandler.Historian using HTML5 pushState and onpopstate
/*
* Copyright 2012 Thomas Broyer <t.broyer@ltgt.net>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@mhawksey
mhawksey / code.js
Created September 17, 2012 12:29
Google Apps Script to generate ChartFusion datasource xml from a Google Spreadsheet
//http://www.google.sc/support/forum/p/apps-script/thread?tid=345591f349a25cb4&hl=en
function setUp() {
ScriptProperties.setProperty('active', SpreadsheetApp.getActiveSpreadsheet().getId());
var svc = ScriptApp.getService();
if (!svc.isEnabled()) {
// it's not enabled, and should be
svc.enable(svc.Restriction.ALL);
}
}
@shin1ogawa
shin1ogawa / GDataCalendarExample.java
Created February 24, 2012 08:31
Apps API Japan #3 Javaサンプル
import java.io.*;
import java.net.*;
public class GDataCalendarExample {
static final String CLIENT_ID = "";
static final String CLIENT_SECRET = "";
static final String REDIRECT_URI = "urn:ietf:wg:oauth:2.0:oob"; // InstalledApplication
static final String SCOPES = "https://www.googleapis.com/auth/calendar";
static final String ENDPOINT = "https://accounts.google.com/o/oauth2";