Skip to content

Instantly share code, notes, and snippets.

View Nickersoft's full-sized avatar
🍜
在吃拉面

Tyler Nickerson Nickersoft

🍜
在吃拉面
View GitHub Profile
@michaeljs1990
michaeljs1990 / main.go
Created July 17, 2020 05:26
Bleve _source example
package main
import (
"bytes"
"encoding/gob"
"fmt"
"github.com/blevesearch/bleve"
"github.com/blevesearch/bleve/document"
"github.com/blevesearch/bleve/index/scorch"
@liorazi
liorazi / Animation+CustomTimingFunctions.swift
Last active May 12, 2024 04:31
Extension to SwiftUI Animation which extends it with more ease timing functions as described in: https://easings.net
import SwiftUI
extension Animation {
public static func easeInSin(duration: Double) -> Animation {
return self.timingCurve(0.47, 0, 0.745, 0.715, duration: duration)
}
public static var easeInSin: Animation = Animation.timingCurve(0.47, 0, 0.745, 0.715)
@yongjun21
yongjun21 / Promise.js
Last active June 28, 2022 11:56
Implement bluebird's Promise.map & Promise.filter with native Promise
Promise.map = function (iterable, mapper, options) {
options = options || {}
let concurrency = options.concurrency || Infinity
let index = 0
const results = []
const iterator = iterable[Symbol.iterator]()
const promises = []
while (concurrency-- > 0) {
@zwaldowski
zwaldowski / CardPresenting.swift
Last active December 7, 2022 09:14
iOS presentation controller for bottom-focused cards using Auto Layout - https://www.icloud.com/iclouddrive/0wJzCDOwwXTRF53bM4xWLbYag#card-magic-ii
import UIKit
private class CardPresenter: UIPresentationController {
private let dimmingView = UIView()
private let roundingView = UIView()
// MARK: -
override init(presentedViewController: UIViewController, presenting presentingViewController: UIViewController?) {
@ServerlessBot
ServerlessBot / IAMCredentials.json
Last active February 24, 2025 15:51
Minimum credential set for Serverless Framework
{
"Statement": [
{
"Action": [
"apigateway:*",
"cloudformation:CancelUpdateStack",
"cloudformation:ContinueUpdateRollback",
"cloudformation:CreateChangeSet",
"cloudformation:CreateStack",
"cloudformation:CreateUploadBucket",
@mcdougal
mcdougal / _error.js
Created September 28, 2018 11:53
Using @sentry/browser with Next.js for client and server-side rendering
import * as Sentry from '@sentry/browser';
import getConfig from 'next/config';
import React from 'react';
const { SENTRY_DSN } = getConfig().publicRuntimeConfig;
Sentry.init({ dsn: SENTRY_DSN });
/**
* Send an error event to Sentry.
@CMCDragonkai
CMCDragonkai / exporting_modules_functions_from_python_init.md
Last active January 6, 2025 19:05
Exporting Modules and Functions from Python `__init__.py` #python

Exporting Modules and Functions from Python __init__.py

Any directory with __init__.py is considered a package in Python.

Any python files inside a package is considered a module.

Modules contain functions and other bindings that is always exported.

If you are outside the package, and you want to import a module from a package:

@asukakenji
asukakenji / 0-go-os-arch.md
Last active April 23, 2025 07:37
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
@schmich
schmich / npm-prerelease.md
Last active June 26, 2024 13:20
Publish a prerelease package to NPM
  • Update package.json, set version to a prerelease version, e.g. 2.0.0-rc1, 3.1.5-rc4, ...
  • Run npm pack to create package
  • Run npm publish <package>.tgz --tag next to publish the package under the next tag
  • Run npm install --save package@next to install prerelease package
@jonbakerfish
jonbakerfish / loop_aria2.sh
Last active August 14, 2024 20:08
aria2 downloads a list of files, loop until all file are finished
#!/bin/bash
aria2c -j5 -i list.txt -c --save-session out.txt
has_error=`wc -l < out.txt`
while [ $has_error -gt 0 ]
do
echo "still has $has_error errors, rerun aria2 to download ..."
aria2c -j5 -i list.txt -c --save-session out.txt
has_error=`wc -l < out.txt`
sleep 10