Skip to content

Instantly share code, notes, and snippets.

@switz
switz / cf-worker-latest-tweets.js
Last active June 10, 2022 17:05
Get your accounts latest tweets in a CF worker
const cacheVersion = 1;
addEventListener('fetch', event => {
event.respondWith(handleRequest(event))
})
const token = ''; // twitter refresh token
const twitterId = 3380909105; // my twitter id
const params = [
/*
* Copyright 2017 Palantir Technologies, Inc. All rights reserved.
*/
import { IconName } from "../iconName";
export const IconSvgPaths16: Record<IconName, string[]> = {
"add": ["M10.99 6.99h-2v-2c0-.55-.45-1-1-1s-1 .45-1 1v2h-2c-.55 0-1 .45-1 1s.45 1 1 1h2v2c0 .55.45 1 1 1s1-.45 1-1v-2h2c.55 0 1-.45 1-1s-.45-1-1-1zm-3-7c-4.42 0-8 3.58-8 8s3.58 8 8 8 8-3.58 8-8-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6s2.69-6 6-6 6 2.69 6 6-2.68 6-6 6z"],
"add-column-left": ["M15 0H1C.45 0 0 .45 0 1v14c0 .55.45 1 1 1h14c.55 0 1-.45 1-1V1c0-.55-.45-1-1-1zm-5 14H2V2h8v12zm4 0h-3V2h3v12zM4 9h1v1c0 .55.45 1 1 1s1-.45 1-1V9h1c.55 0 1-.45 1-1s-.45-1-1-1H7V6c0-.55-.45-1-1-1s-1 .45-1 1v1H4c-.55 0-1 .45-1 1s.45 1 1 1z"],
"add-column-right": ["M8 9h1v1c0 .55.45 1 1 1s1-.45 1-1V9h1c.55 0 1-.45 1-1s-.45-1-1-1h-1V6c0-.55-.45-1-1-1s-1 .45-1 1v1H8c-.55 0-1 .45-1 1s.45 1 1 1zm7-9H1C.45 0 0 .45 0 1v14c0 .55.45 1 1 1h14c.55 0 1-.45 1-1V1c0-.55-.45-1-1-1zM5 14H2V2h3v12zm9 0H6V2h8v12z"],
@switz
switz / Create_a_hotspot.md
Created March 6, 2018 18:23 — forked from vfdev-5/Create_a_hotspot.md
Raspberry Pi - Ubuntu 16.04 Mate - Wifi automatic connection and static IP in terminal
sudo nmcli dev wifi hotspot ifname wlan0 con-name "my-hotspot" ssid "my-hotspot" password "My HotsPoT Strong Password"

More info here

unbindall
bind "0" "slot10"
bind "1" "slot1"
bind "2" "slot2"
bind "3" "slot3"
bind "4" "slot4"
bind "5" "slot5"
bind "6" "slot6"
bind "7" "slot7"
bind "8" "slot8"
@switz
switz / gist:23d4a8cc3db59f9971a9
Last active August 29, 2015 14:20
Phish's most played artists
Phish: 23734
Trey Anastasio: 669
Argent: 524
Traditional: 433
Led Zeppelin: 253
Bill Monroe: 252
Jimi Hendrix Experience: 220
Cyril Ferguson: 207
Strauss, as interpreted by Deodato: 203
Osborne Brothers: 195
func animateLabels() {
self.view.layoutIfNeeded()
UIView.animateWithDuration(3.0, delay: 1, options: .CurveEaseIn,
animations: {
println(self.prevConstraint.constant)
self.prevConstraint.constant += 50.0;
self.view.layoutIfNeeded()
}, completion: nil)
}
@switz
switz / view.swift
Last active August 29, 2015 14:13
class ContainerViewController: UIViewController, UITableViewDelegate, NSFetchedResultsControllerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
// Play on touch down
var td = UILongPressGestureRecognizer(target: self, action: "touchDown:")
td.minimumPressDuration = 0;
td.allowableMovement = 10000;
self.table.addGestureRecognizer(td);
}
<?xml version="1.0" encoding="ISO-8859-1"?>
<JamBase_Data>
<Results_Title>Pulaski, NY</Results_Title><event>
<event_id>2146824</event_id>
<artists>
<artist><artist_id>95896</artist_id><artist_name>Advance Base</artist_name></artist>
</artists>
<event_date>11/21/2013</event_date>
<venue>
module.exports = function (options) {
var randFn = (options && options.fn) || Math.random;
var randCoords = function () { return [randFn(), randFn()] }
function random(schema, options) {
var path = (options && options.path) || 'random';
var field = {};
field[path] = {
type: { type: String, default: 'Point' },
coordinates: { type: [Number], default: randCoords }
@switz
switz / random.js
Last active December 22, 2015 06:38
module.exports = function (options) {
var randFn = (options && options.fn) || Math.random;
var randCoords = function () { return [randFn(), randFn()] } ;
function random(schema, options) {
var path = (options && options.path) || 'random';
var field = {};
field[path] = {
type: { type: String, default: 'Point' },
coordinates: { type: [Number], default: randCoords }