Skip to content

Instantly share code, notes, and snippets.

@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active July 22, 2024 12:48
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
@staltz
staltz / introrx.md
Last active July 22, 2024 09:31
The introduction to Reactive Programming you've been missing
@kristopolous
kristopolous / hn_seach.js
Last active July 24, 2023 04:12
hn job query search
// Usage:
// Copy and paste all of this into a debug console window of the "Who is Hiring?" comment thread
// then use as follows:
//
// query(term | [term, term, ...], term | [term, term, ...], ...)
//
// When arguments are in an array then that means an "or" and when they are seperate that means "and"
//
// Term is of the format:
// ((-)text/RegExp) ( '-' means negation )
@gkhays
gkhays / DrawSineWave.html
Last active July 17, 2024 23:13
Oscillating sine wave, including the steps to figuring out how to plot a sine wave
<!DOCTYPE html>
<html>
<head>
<title>Sine Wave</title>
<script type="text/javascript">
function showAxes(ctx,axes) {
var width = ctx.canvas.width;
var height = ctx.canvas.height;
var xMin = 0;
@pjechris
pjechris / Appfile
Last active May 24, 2022 17:46
fastlane
# you can even provide different app identifiers, Apple IDs and team names per lane:
# More information: https://github.com/fastlane/fastlane/blob/master/docs/Appfile.md
app_identifier ENV["APP_IDENTIFIER"] # The bundle identifier of your app
# You will have to set APP_IDENTIFIER into your .env files
apple_id ENV["APPLE_ID"] # Your Apple email address
team_id ENV["TEAM_ID"] # Developer Portal Team ID
@Pepeye
Pepeye / multi-user.md
Created November 11, 2016 13:26
Homebrew multi user
  1. Create a group brew and add Stan
  2. brew doctor (Allen checks if he installed brew correctly)
  3. sudo chgrp -R brew /usr/local (Change the group of homebrew installation directory)
  4. sudo chmod -R g+w /usr/local (Allow group members to write inside this directory)
  5. sudo chgrp -R brew /Library/Caches/Homebrew (Change the group of homebrew cache directory)
  6. sudo chmod -R g+w /Library/Caches/Homebrew (Allow group members to write inside this directory)
  7. sudo chgrp -R brew /opt (Change the group of the cask installation directory)
  8. sudo chmod -R g+w /opt (Allow group members to write inside this directory)
  9. brew doctor (Stan checks if he can use homebrew)
@joepie91
joepie91 / random.md
Last active July 13, 2024 16:15
Secure random values (in Node.js)

Not all random values are created equal - for security-related code, you need a specific kind of random value.

A summary of this article, if you don't want to read the entire thing:

  • Don't use Math.random(). There are extremely few cases where Math.random() is the right answer. Don't use it, unless you've read this entire article, and determined that it's necessary for your case.
  • Don't use crypto.getRandomBytes directly. While it's a CSPRNG, it's easy to bias the result when 'transforming' it, such that the output becomes more predictable.
  • If you want to generate random tokens or API keys: Use uuid, specifically the uuid.v4() method. Avoid node-uuid - it's not the same package, and doesn't produce reliably secure random values.
  • If you want to generate random numbers in a range: Use random-number-csprng.

You should seriously consider reading the entire article, though - it's

@rhukster
rhukster / watch.sh
Last active April 5, 2021 16:11
Watch script for wellington sassc wrapper
#!/bin/sh
#
# Configuration
#
# sass source
SASS_SOURCE_PATH="scss"
# sass options
@kmohrf
kmohrf / brightness.py
Created February 25, 2017 13:34
Calculate Image brightness with Python Pillow
import sys
from PIL import Image
def calculate_brightness(image):
greyscale_image = image.convert('L')
histogram = greyscale_image.histogram()
pixels = sum(histogram)
brightness = scale = len(histogram)
import hoistStatics from 'hoist-non-react-statics';
import React from 'react';
/**
* Allows two animation frames to complete to allow other components to update
* and re-render before mounting and rendering an expensive `WrappedComponent`.
*/
export default function deferComponentRender(WrappedComponent) {
class DeferredRenderWrapper extends React.Component {
constructor(props, context) {