This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// src https://codepen.io/sachmata/post/elegant-pairing | |
szudzik.getindex = function(x, y) { | |
var xx = x >= 0 ? x * 2 : x * -2 - 1; | |
var yy = y >= 0 ? y * 2 : y * -2 - 1; | |
return (xx >= yy) ? (xx * xx + xx + yy) : (yy * yy + xx); | |
}; | |
szudzik.unpair = function(z) { | |
var sqrtz = Math.floor(Math.sqrt(z)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python | |
# | |
# Connects to a Wifi network | |
# | |
import os | |
def commandExists(command): | |
def canExecute(file): | |
return os.path.isfile(file) and os.access(file, os.X_OK) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { CALL_API } from 'redux-api-middleware' | |
export function fetchLocations() { | |
return { | |
[CALL_API]: { | |
endpoint: 'http://api.somesite.com/api/locations', | |
method: 'GET', | |
// Don't have to manually add the Authorization header to every request. | |
headers: { 'Content-Type': 'application/json' }, | |
types: ['REQUEST', 'SUCCESS', 'FAILURE'] |