Skip to content

Instantly share code, notes, and snippets.

@adamwangxx
adamwangxx / color.swift
Created May 9, 2022 02:11
[Generating random pastel colors] #swift
extension UIColor {
static var random: UIColor {
return UIColor(
hue: .random(in: 0...1),
saturation: 0.4,
brightness: 0.9,
alpha: 1
)
}
}
global.THREE = require("three");
const canvasSketch = require('canvas-sketch');
const Random = require('canvas-sketch-util/random');
const gradientHeight = 512;
const settings = {
dimensions: [ 2048, gradientHeight * 2 ]
};
@adamwangxx
adamwangxx / TurnipPrices.cpp
Created May 11, 2020 16:01 — forked from Treeki/TurnipPrices.cpp
AC:NH turnip price calculator
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
// munged from https://github.com/simontime/Resead
namespace sead
{
class Random
{
@adamwangxx
adamwangxx / catchMarkInXcodeScript.sh
Last active November 20, 2019 13:47
Xcode catch TODO & FIXME script #Xcode
TAGS="TODO|FIXME"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/"
@adamwangxx
adamwangxx / glsl.json
Last active May 23, 2019 07:06 — forked from lewislepton/glsl.json
GLSL snippets for visual studio code/kode studio
/*
AUTO-COMPLETE SNIPPETS FOR GLSL WITHIN VISUAL CODE STUDIO
Lewis Lepton
https://lewislepton.com
useful places that i grabbed info from
http://www.shaderific.com/glsl
https://www.khronos.org/opengl/wiki/OpenGL_Shading_Language
plus various other papers & books
*/
@adamwangxx
adamwangxx / txt_to_reminders.applescript
Created April 26, 2019 06:30 — forked from n8henrie/txt_to_reminders.applescript
Demonstration of using AppleScript with Reminders.app
--taken from http://benguild.com/2012/04/11/how-to-import-tasks-to-do-items-into-ios-reminders/#comment-1346894559
--set theFileContents to (read file "Users:n8henrie:Desktop:Reminders.txt") -- Change this to the path to your downloaded text file with your tasks in it! (Note the : instead of a / between folders) Or, just name them Reminders.txt and put them in your downloads folder
--set theLines to paragraphs of theFileContents
set theLines to {"task name 1", "task name 2"}
repeat with eachLine in theLines
tell application "Reminders"
set mylist to list "Your List Name"
tell mylist
make new reminder at end with properties {name:eachLine, due date:date "7/10/2014 3:00 PM"}
@adamwangxx
adamwangxx / iTerm.applescript
Last active March 29, 2019 11:50
Alfred & iTerm AppleScript
-- This is v0.7 of the custom script for AlfredApp for iTerm 3.1.1+
-- created by Sinan Eldem www.sinaneldem.com.tr
on alfred_script(q)
if application "iTerm2" is running or application "iTerm" is running then
run script "
on run {q}
tell application \"iTerm\"
activate
try
@adamwangxx
adamwangxx / protocol.swift
Last active March 28, 2019 05:13
Swift generic protocol from wechat group
//: Playground - noun: a place where people can play
import UIKit
protocol P {
}
protocol ResultProtocol {
associatedtype Value