Skip to content

Instantly share code, notes, and snippets.

@atika
atika / NSTimeZoneTest.swift
Created March 10, 2016 09:59
NSTimeZone tests and change app default TimeZone in Swift
let tz = NSTimeZone.init(forSecondsFromGMT:3600)
NSTimeZone.setDefaultTimeZone(tz) // Change app default timezone
print(tz) // GMT+0100 (UTC+1) offset 3600
print(NSDate()) // 2016-03-10 09:57:44 +0000
print(tz.abbreviation) // Optional("UTC+1")
print(tz.name) // GMT+0100
print(tz.description) // GMT+0100 (UTC+1) offset 3600
@atika
atika / RemapValueToAnotherRange.swift
Created March 10, 2016 10:10
Remap/Convert a value from one range to another range (graph) in Swift
let high1 = 1000
let low1 = 200
let high2 = 250
let low2 = 10
let value = 200
let remapedValue = low2 + (value - low1) * (high2 - low2) / (high1 - low1)
@atika
atika / CodeRunner-AngularJS-Exemple.js
Created March 10, 2016 10:58
CodeRunner compilation script to have Javascript, HTML and CSS in the same file
// The first script tag is optional if you start with javascript
//<script>
$(document).ready(function () {
$("body").append("<br>jQuery said AngularJS rocks!");
alert($(document).html());
});
angular.module('PricesApp', [])
.controller("PriceController", function () {
@atika
atika / marked-markdown-preprocessor.rb
Last active September 29, 2018 03:40
Use Marked 2 markdown preprocessor functionality to rewrite each image URL to an absolute path on the system before displaying the preview.
#!/usr/bin/ruby
require 'pathname'
imgURLRegex = /^(!\[.*?\]\()([^\s\)]*)(\s*.*\))/
rootsPaths = [
'/Users/username/Path/To/hexo/source/',
'/Another/PathTo/Website/Directory/'
]
@atika
atika / network_drive.list
Created March 26, 2017 15:50
Generate macOS apps from a list to mount your networks volumes
Awesome Volume;afp://macbookpro.local/MyHD
Home on MacBookPro;afp://macbookpro.local/macuser
DiskStation Video;smb://192.168.0.20/video
DiskStation Music;smb://192.168.0.20/music
@atika
atika / README.md
Last active September 25, 2023 19:01
Text field and options dropdown for espanso (macOS only)

Simple prompt for espanso https://espanso.org/ on macOS

For the time being, espanso does not come with a graphical user interface, in the meanwhile you can use this workaround to prompt for text or select result in a list, on macOS.

Create a folder scripts in the espanso preferences folder and copy these files: /Users/<username>/Preferences/espanso/scripts/.

You can also copy Pashua app app into this folder.

espanso popup demo