Skip to content

Instantly share code, notes, and snippets.

Avatar
🐏
Bah.

Michoel Samuels AnalyzePlatypus

🐏
Bah.
  • Jerusalem, Israel
View GitHub Profile
@sainf
sainf / jsPDF_line_wrap.md
Last active Feb 18, 2020 — forked from AnalyzePlatypus/jsPDF_line_wrap.md
Helper function for line-wrapping in jsPDF
View jsPDF_line_wrap.md
@EvanBacon
EvanBacon / apple-touch-startup-image.html
Created Apr 17, 2019
An example of full iOS PWA startup image (splash screen) support.
View apple-touch-startup-image.html
<html>
<head>
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-touch-fullscreen" content="yes" />
<meta name="apple-mobile-web-app-title" content="Expo" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
<link
rel="apple-touch-icon"
sizes="180x180"
@cellularmitosis
cellularmitosis / EmojiPointersDemo.swift
Created Aug 15, 2018
Representing pointer values as emoji can be useful for "visually" debugging certain issues, like cell reuse, etc.
View EmojiPointersDemo.swift
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let window = UIWindow(frame: UIScreen.main.bounds)
View index.js
// install first binaries from http://ffxsam.s3.amazonaws.com/public/audiowaveform-lambda.zip
// @author Andrzej Ojczenasz https://github.com/ojczeo
// @version '1.0.0'
'use strict';
process.env.PATH = process.env.PATH + ':' + process.env.LAMBDA_TASK_ROOT + '/bin';
function getExtension(filename) {
var ext = path.extname(filename||'').split('.');
return ext[ext.length - 1];
@xola139
xola139 / Invalid Host Header NGROK
Created Feb 19, 2018
When Invalid Host Header when ngrok tries to connect to Angular or React dev server
View Invalid Host Header NGROK
When Invalid Host Header when ngrok tries to connect to Angular or React dev server use this form for run ngrok.
ngrok http 8080 -host-header="localhost:8080"
ngrok http --host-header=rewrite 8080
@bradwestfall
bradwestfall / S3-Static-Sites.md
Last active Jul 23, 2021
Use S3 and CloudFront to host Static Single Page Apps (SPAs) with HTTPs and www-redirects. Also covers deployments.
View S3-Static-Sites.md

S3 Static Sites

What this will cover

  • Host a static website at S3
  • Redirect www.website.com to website.com
  • Website can be an SPA (requiring all requests to return index.html)
  • Free AWS SSL certs
  • Deployment with CDN invalidation

Resources

@primaryobjects
primaryobjects / mouse.gif
Last active Mar 9, 2021
View the mouse pointer position in Selenium Nightwatch. Execute this code when the page loads or in the javascript console. See https://stackoverflow.com/a/35867777
@milon87
milon87 / api.js
Created Sep 9, 2017
how to use x-www-form-urlencoded in react native
View api.js
var details = {
'userName': 'test@gmail.com',
'password': 'Password!',
'grant_type': 'password'
};
var formBody = [];
for (var property in details) {
var encodedKey = encodeURIComponent(property);
var encodedValue = encodeURIComponent(details[property]);
@shapeshed
shapeshed / aws-cf-logs
Last active Feb 12, 2021
Fetch AWS Cloudfront Logs, decompress, combine into a single file and remove comments
View aws-cf-logs
#!/usr/bin/env bash
BUCKET=$1
CWD=$(pwd)
if [[ -n $1 ]]; then
aws s3 sync s3://$BUCKET/cf-logs .
cat *.gz > combined.log.gz
find $CWD ! -name 'combined.log.gz' -name '*.gz' -type f -exec rm -f {} +
gzip -d combined.log.gz
@rosenfeld
rosenfeld / thread-pool.rb
Created Jun 7, 2016
Simple thread pool implementation in Ruby
View thread-pool.rb
require 'thread' # for Mutex: Ruby doesn't provide out of the box thread-safe arrays
class ThreadPool
def initialize(max_threads = 10)
@pool = SizedQueue.new(max_threads)
max_threads.times{ @pool << 1 }
@mutex = Mutex.new
@running_threads = []
end