Skip to content

Instantly share code, notes, and snippets.

View SylarRuby's full-sized avatar

Daveyon Mayne SylarRuby

  • UK
View GitHub Profile
@Hiroki-Kawakami
Hiroki-Kawakami / ContentView.swift
Last active May 7, 2024 18:38
SwiftUI Change Status Bar Color with UIWindow
//
// ContentView.swift
// StatusBarTest
//
// Created by hiroki on 2021/02/11.
//
import SwiftUI
struct ContentView: View {
@alfmatos
alfmatos / nodejs-yarn-install.sh
Last active June 6, 2019 17:58
Docker nodejs and yarn install (for bitbucket pipelines)
#!/bin/bash
# Script to install node.js 10.x and yarn repo onto a Debian or Ubuntu system (docker)
#
# Run as root or insert `sudo -E` before `bash`:
#
# Example: curl -sL https://gist.githubusercontent.com/alfmatos/f0a5218c80e4866da1beb90cffb008f9/raw/ | bash -
# Install nodejs 10.x
curl -sL https://deb.nodesource.com/setup_10.x | bash -
@budidino
budidino / string-truncate.swift
Last active April 3, 2024 20:11 — forked from vicc/string-truncate.swift
String truncate extension for Swift 4
extension String {
/*
Truncates the string to the specified length number of characters and appends an optional trailing string if longer.
- Parameter length: Desired maximum lengths of a string
- Parameter trailing: A 'String' that will be appended after the truncation.
- Returns: 'String' object.
*/
func trunc(length: Int, trailing: String = "…") -> String {
return (self.count > length) ? self.prefix(length) + trailing : self
@ericmdev
ericmdev / docker-remove-all.sh
Last active October 20, 2021 09:15 — forked from JeffBelback/docker-destroy-all.sh
Docker - stop and remove all containers and images.
#!/bin/bash
# Stop all containers.
docker stop $(docker ps -a -q)
# Delete all containers.
docker rm $(docker ps -a -q)
# Delete all images.
docker rmi --force $(docker images -q)
@o-nasteka
o-nasteka / safari.js
Created November 20, 2015 21:45
required input Safari
<script type="text/javascript">
function checkForm(){
var forms = document.getElementsByTagName('form');
for (var i = 0; i < forms.length; i++) {
forms[i].noValidate = true;
forms[i].addEventListener('submit', function(event) {
//Prevent submission if checkValidity on the form returns false.
if (!event.target.checkValidity()) {
event.preventDefault();
@rdetert
rdetert / states.rb
Last active March 30, 2023 17:53 — forked from dblandin/states.rb
Hash of the United States in Ruby
::States = { AK: "Alaska",
AL: "Alabama",
AR: "Arkansas",
AS: "American Samoa",
AZ: "Arizona",
CA: "California",
CO: "Colorado",
CT: "Connecticut",
DC: "District of Columbia",
DE: "Delaware",
@dblandin
dblandin / states.rb
Created June 25, 2012 22:51
Ruby array of US state name and abbreviations
states = Array[ ["AK", "Alaska"],
["AL", "Alabama"],
["AR", "Arkansas"],
["AS", "American Samoa"],
["AZ", "Arizona"],
["CA", "California"],
["CO", "Colorado"],
["CT", "Connecticut"],
["DC", "District of Columbia"],
["DE", "Delaware"],