Skip to content

Instantly share code, notes, and snippets.

View andykent's full-sized avatar

Andy Kent andykent

View GitHub Profile
@andykent
andykent / slate-react.d.ts
Last active May 19, 2020 11:45
Slate TypeScript Definitions
declare module 'slate-react' {
import * as Slate from 'slate'
import * as Immutable from 'immutable'
import { ReactNode } from 'react'
type RenderMarkProps = {
mark: { type: string },
children: ReactNode
}
@andykent
andykent / FastImg.css
Last active August 16, 2020 20:47
Render Medium style blurred preview images using react-imgix
.aspectWrapper {
position: absolute;
width: 100%;
height: 100%;
}
.wrapper {
position: absolute;
width: 100%;
height: 100%;
@andykent
andykent / orca.rb
Last active December 18, 2015 16:58
An Example Orca File
require "rest-client"
require "orca/extensions/apt"
require "orca/extensions/file_sync"
group 'server' do
node 'kent-web-1', 'xxx.xxx.xxx.xxx', :test_url => 'http://mysite.com/'
end
package 'app' do
depends_on 'deploy-user'
@andykent
andykent / unescape.go
Created June 18, 2013 14:54
Small go program to run through a list on stdin and URL unescape each line.
package main
import "fmt"
import "os"
import "net/url"
import "bufio"
func main() {
scanner := bufio.NewScanner(os.Stdin)
for scanner.Scan() {
# name: Github
# description: search github
# keyword: github
bolt.run ->
if command.hasQuery
log command.query
url = "https://api.github.com/legacy/repos/search/#{command.query}?callback=?"
http.getJSON url, (data) ->
log data
# name: Google Search
# description: Search Google for stuff.
# keyword: google
# homepage: http://google.com
bolt.run ->
if command.hasQuery
url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q="+command.query+"&callback=?"
http.getJSON url, (data) ->
# name: Echo Bot
# description: Say someting and I'll say it back
# keyword: echo
bolt.run ->
if command.hasQuery
result(title:command.query, description: "That's what you said!")
@andykent
andykent / gist:3048069
Created July 4, 2012 16:06
Basic Canvas Drawing
// add some interactivity
var canvas = document.querySelector("#canvas"),
ctx = canvas.getContext("2d");
ctx.beginPath();
ctx.lineWidth = 10;
@andykent
andykent / connect.rb
Created July 2, 2012 10:30
A Small TCP Echo Server
require "socket"
s = TCPSocket.new 'localhost', 1234
s.puts "name: Andy"
s.puts "Hello World"
@andykent
andykent / alert.js
Created May 24, 2011 16:46
Simple example showing advantages of async JS loading
alert('Hello from alert.js');