Skip to content

Instantly share code, notes, and snippets.

View mekanics's full-sized avatar

Alexandre Joly mekanics

View GitHub Profile
@rudotriton
rudotriton / scriptable-calendar-widget.md
Last active August 31, 2024 01:29
Customizable iOS Calendar widget in Scriptable

Scriptable Calendar Widget

scriptable calendar

For ease of maintainability this project has moved from this gist to its own repository. You can go and visit it there.

@camcaine
camcaine / TabSelect.swift
Last active February 25, 2021 08:18
Managing TabView selections in SwiftUI
import SwiftUI
protocol TabSelectable {
associatedtype Tab
func shouldSelect(_ tab: Tab) -> Bool
}
@propertyWrapper
struct TabSelection<Value: Hashable> {
@nanorepublica
nanorepublica / get_prismicio_schema.js
Last active March 11, 2021 17:49
Quick script to get a GraphQL schema file for Content Models from Prismic.io graphql endpoint.
const { buildClientSchema, printSchema } = require("graphql");
const fs = require("fs");
const { PrismicLink } = require('apollo-link-prismic');
const { gql, ApolloClient, InMemoryCache } = require("apollo-boost");
const prismicReposistory = "<prismic.io repository name>"
const accessToken = "<access token from the repo API settings page"
const ouputFile = "./prismic.graphql"
@andyrbell
andyrbell / scanner.sh
Last active March 28, 2025 17:57
Make a pdf look scanned using ImageMagick
# use ImageMagick convert
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf
@emotality
emotality / duplicate_line_xcode.md
Last active January 24, 2025 13:49
Xcode - Duplicate Line key binding

NOTE (2022-07-09): Xcode finally added this functionality in Xcode 14, please see release notes here:

New Features in Xcode 14 Beta 3
When editing code, the Edit > Duplicate menu item and its corresponding keyboard shortcut now duplicate the selected text — or the line that currently contains the insertion point, if no text is selected. (8614499) (FB5618491)


Xcode line duplicate

Bind keys to duplicate lines in Xcode

@dboskovic
dboskovic / _readme.md
Last active April 10, 2019 17:56
KeystoneJS: Cloudinary Cache => Amazon S3

I had a client who I built a site for (ecommerce) that had a lot of high resolution images. (running about 500gb/mo). Cloudinary charges $500/mo for this usage and Amazon charges about $40. I wrote some middleware that I used to wrap my cloudinary urls with in order to enable caching. This is entirely transparent and still enables you to use all the cool cloudinary effect and resizing functions. Hopefully this is useful to someone!

I think using deasync() here is janky but I couldn't think of another way to do it that allowed for quite as easy a fix.

@mweibel
mweibel / React Component
Last active August 29, 2015 14:12
WebStorm/IntelliJ React component file template
/** @jsx React.DOM */
'use strict';
var React = require('react');
## Will replace dashes in names with camelCase
#set($componentName = "")
#foreach($str in $NAME.split("-"))
#set($str = $str.substring(0,1).toUpperCase()+$str.substring(1))
@learncodeacademy
learncodeacademy / flightplan-deploy.md
Last active January 7, 2024 11:58
Deploy Node.js Apps with Flightplan

##Setup your server (this would ideally be done with automated provisioning)

  • add a deploy user with password-less ssh see this gist
  • install forever npm install -g forever

##Install flightplan

  • npm install -g flightplan
  • in your project folder npm install flightplan --save-dev
  • create a flightplan.js file
@s4y
s4y / 1 - get a health store.swift
Created September 2, 2014 03:54
HealthKit examples
let healthStore = HKHealthStore()
@ricardozea
ricardozea / Smooth scroll to top of page.markdown
Last active May 12, 2024 12:12
Smooth scroll to top of page

Visit the new improved script here! Smooth scroll to top of page (Improved!)


Smooth scroll to top of page (Legacy!)

If you need a plain JavaScript function to add a smooth scrolling back to the top of the page, you can use this script.

  1. Add an id of "top" to the <body> tag. Like this: <body id="top">
  2. Add the onclick function to the link. Like this: <a href="#top" onclick="scrollToTop(); return false">Back to Top ↑</a>