Skip to content

Instantly share code, notes, and snippets.

@xl1
xl1 / gist:fe779a817a9d4938193d
Last active May 6, 2024 03:35
Facebook API: 有効期限の長い Access Token を取得する

Facebook API: 有効期限の長い Access Token を取得する

tl;dr

  1. User Access Token を取得する
  2. それを使って長い期限のトークンを取得する
  3. /me/accounts?access_token={long_lived_token}
  4. 無期限のトークンが手に入る

API のバージョン

@staltz
staltz / router.js
Last active May 6, 2024 03:33 — forked from axefrog/router.js
Simple router driver for Cycle.js utilising Router5 for routing functionality and adapting some of the code from VisionMedia's Page.js for automatic link click intercepting
'use strict';
import {Router5, RouteNode} from 'router5';
import logger from '../logger';
// The set of valid sink functions includes synchronous state-affecting router functions that do not require a callback
// and which do not have a significant return value other than the router object itself.
const validSinkFuncs = ['add','addNode','canActivate','deregisterComponent','navigate','registerComponent','setOption','start','stop'];
function validateAndRemapSinkArgument(arg) {
@staltz
staltz / app.js
Created June 28, 2015 11:55
Draft of Cycle.js HTTP Driver
const Cycle = require('@cycle/core');
const CycleWeb = require('@cycle/web');
const makeHTTPDriver = require('@cycle/http');
const h = CycleWeb.h;
function main(responses) {
const GITHUB_SEARCH_API = 'https://api.github.com/search/repositories?q=';
// This essentially models when search requests are supposed
// to happen
@jhusain
jhusain / gist:db542bf5e2a0b79098ab
Created August 4, 2015 19:52
Redux style app
// mock falcor Model
function Model(root, path) {
this.root = root;
this.path = path || [];
}
Model.prototype.bind = function(path) {
return new Model(this.root, this.path.concat(path));
};
@jhusain
jhusain / gist:3c510869ec091772c440
Last active May 6, 2024 03:32
Observable map function
class Observable {
map(fn) {
if (typeof fn !== "function")
throw new TypeError(fn + " is not a function");
let C = this.constructor[Symbol.species];
return new C(observer => {
@jhusain
jhusain / gist:4b14f5069f3a254cfa0a
Created April 19, 2015 16:27
Converting event to Observable
function fromEvent(dom, eventName) {
return {
forEach: function(observer) {
var handler = (e) => {
observer.onNext(e);
};
dom.addEventListener(eventName, handler);
// Subscription
return {
@ChuckMichael
ChuckMichael / vcredistr.md
Last active May 6, 2024 03:32
Visual C++ Redistributable Packages
@kyo-takano
kyo-takano / making-the-most-of-local-llms.ipynb
Last active May 6, 2024 03:31
ローカルLLMはこーやって使うの💢
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jhusain
jhusain / index.js
Created April 3, 2015 02:37
requirebin sketch
// When you click the button on the right, this program
// retrieves a stock quote from a stubbed method. If the
// button is clicked while a (stubbed/fake) network request
// is in-flight, then the fake request is cancelled and
// a new one is issued. To confirm this, press the button
// several times and notice that only one stock quote is
// returned.
var Task = require('task-lib');
var getQuoteButton = document.getElementById('getQuote');
@jhusain
jhusain / index.js
Created April 3, 2015 02:42
requirebin sketch
// When you click the button on the right, this program
// retrieves a stock quote from a stubbed method. If the
// button is clicked while a (stubbed/fake) network request
// is in-flight, then the fake request is cancelled and
// a new one is issued. To confirm this, press the button
// several times and notice that only one stock quote is
// returned.
var Task = require('task-lib');
var getQuoteButton = document.createElement('button');