Skip to content

Instantly share code, notes, and snippets.

View danielemaddaluno's full-sized avatar

Daniele Maddaluno danielemaddaluno

View GitHub Profile
@danielemaddaluno
danielemaddaluno / gist:7cb7808316cc63efc884dfc81c1526d7
Created October 30, 2023 13:35 — forked from nicferrier/gist:2277987
Clone a git repo if it does not exist, or pull into it if it does exist
#!/bin/sh
REPOSRC=$1
LOCALREPO=$2
# We do it this way so that we can abstract if from just git later on
LOCALREPO_VC_DIR=$LOCALREPO/.git
if [ ! -d $LOCALREPO_VC_DIR ]
then
@danielemaddaluno
danielemaddaluno / TriangleManipulator.java
Created October 4, 2020 12:18 — forked from jewelsea/TriangleManipulator.java
Demonstrates modifying a polygon's shape in JavaFX by allowing the user to drag around control points attached to the corners of the Polygon.
import javafx.scene.Scene;
import javafx.application.Application;
import javafx.beans.property.*;
import javafx.beans.value.*;
import javafx.collections.*;
import javafx.event.EventHandler;
import javafx.scene.*;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;
@danielemaddaluno
danielemaddaluno / rep_rowR.md
Created September 21, 2020 21:03 — forked from casallas/rep_rowR.md
Repeating rows in R
@danielemaddaluno
danielemaddaluno / image_segmentation_demo.R
Created August 25, 2020 08:17 — forked from rwalk/image_segmentation_demo.R
Segment an image by color using Kmeans
# image segmentation demo
# author: rwalker (ryan@ryanwalker.us)
# license: MIT
library("jpeg")
library("png")
library("graphics")
library("ggplot2")
library("gridExtra")
#######################################################################################
@danielemaddaluno
danielemaddaluno / getMacUUID.swift
Created March 7, 2020 23:08 — forked from ericdke/getMacUUID.swift
Swift: get the Mac UUID
func getSystemUUID() -> String? {
let dev = IOServiceMatching("IOPlatformExpertDevice")
let platformExpert: io_service_t = IOServiceGetMatchingService(kIOMasterPortDefault, dev)
let serialNumberAsCFString = IORegistryEntryCreateCFProperty(platformExpert, kIOPlatformUUIDKey, kCFAllocatorDefault, 0)
IOObjectRelease(platformExpert)
let ser: CFTypeRef = serialNumberAsCFString.takeUnretainedValue()
if let result = ser as? String {
return result
}
return nil
@danielemaddaluno
danielemaddaluno / JavaFXTrayIconSample.java
Created August 3, 2019 21:31 — forked from jewelsea/JavaFXTrayIconSample.java
Demonstrate using the System Tray (AWT) to control a JavaFX application.
import javafx.application.*;
import javafx.geometry.Pos;
import javafx.scene.*;
import javafx.scene.control.Label;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.stage.*;
import javax.imageio.ImageIO;
import java.io.IOException;
@danielemaddaluno
danielemaddaluno / vimeo.php
Created July 2, 2019 11:05 — forked from danieltroger/vimeo.php
Download embedded vimeo video (halfautomatic)
<?php
/*
Copyright (c) 2017 Daniel Troger
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
ACTION = build
AD_HOC_CODE_SIGNING_ALLOWED = NO
ALTERNATE_GROUP = staff
ALTERNATE_MODE = u+w,go-w,a+rX
ALTERNATE_OWNER = grantdavis
ALWAYS_SEARCH_USER_PATHS = NO
ALWAYS_USE_SEPARATE_HEADERMAPS = YES
APPLE_INTERNAL_DEVELOPER_DIR = /AppleInternal/Developer
APPLE_INTERNAL_DIR = /AppleInternal
APPLE_INTERNAL_DOCUMENTATION_DIR = /AppleInternal/Documentation
@danielemaddaluno
danielemaddaluno / Fonts.swift
Last active February 27, 2019 22:03 — forked from feighter09/Fonts.swift
Set global font for iOS app in one place
public protocol SwizzlingInjection: class {
static func inject()
}
class SwizzlingHelper {
private static let doOnce: Any? = {
UIFont.inject()
return nil
}()
@danielemaddaluno
danielemaddaluno / Disable auto-scroll after load
Created February 23, 2019 21:22 — forked from SpiritOfDarkDragon/Disable auto-scroll after load
Disabling auto-scroll scrollview, after data in webview is loaded
Adding the "descendantFocusability" attribute to the ScrollView's containing LinearLayout, with the value "blockDescendants". In my case:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:descendantFocusability="blocksDescendants" >