An introduction to curl
using GitHub's API.
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
var http = require('http'); | |
var path = require('path'); | |
var fs = require('fs'); | |
var AUDIOFILE = "./audio.ogg"; | |
function serveWithRanges(request, response, content) { | |
var range = request.headers.range; | |
var total = content.length; | |
var parts = range.replace(/bytes=/, "").split("-"); |
An introduction to curl
using GitHub's API.
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
# default.custom.yaml | |
# save it to: | |
# ~/.config/ibus/rime (linux) | |
# ~/Library/Rime (macos) | |
# %APPDATA%\Rime (windows) | |
patch: | |
schema_list: | |
- schema: luna_pinyin # 朙月拼音 | |
- schema: luna_pinyin_simp # 朙月拼音 简化字模式 |
# Rime setting | |
patch: | |
"menu/page_size": 9 | |
schema_list: | |
- schema: luna_pinyin | |
- schema: cangjie5 | |
- schema: luna_pinyin_fluency | |
- schema: luna_pinyin_simp | |
- schema: double_pinyin_flypy |
@echo off | |
:: This script will setup dropbox to sync Chrome's User Stylesheets. | |
:: It is a shim since Chromium probably won't add this file to Chrome-Sync in the future. | |
:: See http://code.google.com/p/chromium/issues/detail?id=136479 for more details. | |
:: | |
:: The main purpose of this script is to sync the style sheet used for Dev Tools. | |
:: See http://darcyclarke.me/design/skin-your-chrome-inspector/ for more information | |
:: on stylying your Chrome Dev Tools. | |
:: |
Problem: When linking to the raw version of a gist, the link changes with each revision.
Solution:
To return the first file from a gist: https://gist.github.com/[gist_user]/[gist_id]/raw/
To get a file from multi–file gist: https://gist.github.com/[gist_user]/[gist_id]/raw/[file_name]
function convertTimestamp(timestamp) { | |
var d = new Date(timestamp * 1000), // Convert the passed timestamp to milliseconds | |
yyyy = d.getFullYear(), | |
mm = ('0' + (d.getMonth() + 1)).slice(-2), // Months are zero based. Add leading 0. | |
dd = ('0' + d.getDate()).slice(-2), // Add leading 0. | |
hh = d.getHours(), | |
h = hh, | |
min = ('0' + d.getMinutes()).slice(-2), // Add leading 0. | |
ampm = 'AM', | |
time; |
// this is the background code... | |
// listen for our browerAction to be clicked | |
chrome.browserAction.onClicked.addListener(function (tab) { | |
// for the current tab, inject the "inject.js" file & execute it | |
chrome.tabs.executeScript(tab.ib, { | |
file: 'inject.js' | |
}); | |
}); |
{ | |
"libs": [ | |
"browser", | |
"underscore", | |
"jquery" | |
], | |
"plugins": { | |
"node": {} | |
} | |
} |
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { | |
// some code.. | |
} |