Skip to content

Instantly share code, notes, and snippets.

View jeremieweldin's full-sized avatar

Jeremie Weldin jeremieweldin

  • Summerville, SC
  • 13:24 (UTC -04:00)
View GitHub Profile
@stueccles
stueccles / array.verse
Last active June 18, 2024 03:14
A Verse module that adds useful functions to Verse Arrays including Map, Reduce etc.
using { /Verse.org/Random }
Array<public> := module:
# Makes an `array` with only unique elements
(Input:[]t where t:subtype(comparable)).Unique<public>()<transacts>:[]t =
var UniqueArray : []t = array{}
for (Value : Input):
if (UniqueArray.Find[Value] > -1) {}
else:
@WahlbeckUEFN
WahlbeckUEFN / get_closest_player.verse
Created May 10, 2023 15:01
Get closest player to prop in UEFN and Verse
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
GetClosestPlayerToProp(AllPlayers: []fort_character, Prop : creative_prop): ?fort_character =
var ClosestPlayer : ?fort_character = false
var ClosestDistance: float = 1000000000.0 # initialize with a large number
for (Player : AllPlayers):
#ThermoZztat
# These are example segments meant to be copied into the 3 main files.
############### Examples for Configuration.yaml ###############
switch:
- platform: mqtt
name: "Upstairs Fan"
command_topic: "cmnd/ThermoZztat/POWER1"
state_topic: "stat/ThermoZztat/POWER1"
qos: 1
@primaryobjects
primaryobjects / json2csharp.txt
Last active March 25, 2024 07:14
Neat trick to convert JSON to a C# class in Visual Studio.
1. Copy some JSON to your clipboard. Need some JSON? Here you go http://goo.gl/mWZSEL
2. In Visual Studio, right-click your project and select Add->Class.
3. Highlight the following code in your class:
class Class1
{
}
4. From the top menu, select Edit->Paste Special->Paste JSON as Classes.
5. Rename "Rootobject" to your desired class name. Done!
@kristopherjohnson
kristopherjohnson / pretty_backtrace.rb
Last active October 17, 2018 14:04
Ruby: Pretty-printed exception backtrace
# Generate a backtrace string for given exception.
# Generated string is a series of lines, each beginning with a tab and "at ".
def pretty_backtrace(exception)
"\tat #{exception.backtrace.join("\n\tat ")}"
end
# Generate a string containing exception message followed by backtrace.
def pretty_exception(exception)
"#{exception.message}\n#{pretty_backtrace(exception)}"
end
@turowicz
turowicz / swift-json-class.md
Last active February 21, 2017 07:00
Apple Swift strong type object serialization to JSON
@higepon
higepon / API.swift
Last active July 31, 2023 16:00
An example of JSON API call in Swift
//
// API.swift
//
// Created by Taro Minowa on 6/10/14.
// Copyright (c) 2014 Higepon Taro Minowa. All rights reserved.
//
import Foundation
typealias JSONDictionary = Dictionary<String, AnyObject>
@mshafrir
mshafrir / states_hash.json
Created May 9, 2012 17:05
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@bigfive
bigfive / 20120118012543_create_site_configuration.rb
Created January 20, 2012 02:01
Ruby on Rails. Key value table for site configuration integrated with Active admin and formtastic forms
# db/migrations/20120118012543_create_site_configuration.rb
class CreateSiteConfigurations < ActiveRecord::Migration
def change
create_table :site_configurations do |t|
t.string :key
t.text :value
t.string :form_type
t.string :form_collection_command
@cbmeeks
cbmeeks / bootstrap_form_builder.rb
Created December 28, 2011 03:59
Twitter Bootstrap Form Builder
class BootstrapFormBuilder < ActionView::Helpers::FormBuilder
delegate :capture, :content_tag, :tag, to: :@template
%w[text_field text_area password_field collection_select].each do |method_name|
define_method(method_name) do |name, *args|
errors = object.errors[name].any?? " error" : ""
error_msg = object.errors[name].any?? content_tag(:span, object.errors[name].join(","), class: "help-inline") : ""
content_tag :div, class: "clearfix#{errors}" do