Skip to content

Instantly share code, notes, and snippets.

View leogdion's full-sized avatar

leogdion leogdion

View GitHub Profile
@leogdion
leogdion / export-script.sh
Last active August 1, 2017 20:20
export-script.sh
#curl -s http://javascriptweekly.com/issues/$1 | pup '.issue-html table div > a[title] json{}' | jq '.[]' | jq -r '.text + " " + .href'
#curl -s http://iosdevweekly.com/issues/$1 | pup 'section .item h3.item__title a json{}' | jq '.[]' | jq -r '.text + " " + .href'
#curl -s http://www.echojs.com | pup 'article[data-news-id] a[rel] json{}' | jq '.[]' | jq -r '.text + " " + .href'
#curl -s https://swiftnews.curated.co/issues/$1 | pup 'section .item h3.item__title a json{}' | jq '.[]' | jq -r '.text + " " + .href'
#curl -s https://swiftnews.curated.co/issues/$1 | pup 'section .item h3.item__title a json{}' | jq '.[]' | jq -r '.text + " " + .href'
#curl -s http://ios-goodies.com | pup '.post .body-text li json{}' | jq '.[]' | jq -r '.children[0].text + " by " + .children[1].text + " " + .children[0].href'
curl -s https://mobilewebweekly.com/issues/$1 | pup '.issue-html table table table table td > a[title] json{}' | jq '.[]' | jq -r '.text + " http://" + .title'
@leogdion
leogdion / index.js
Created May 25, 2017 17:59
requirebin sketch
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
var base32 = require('base32');
const uuidV4 = require('uuid/v4');
function chunkString(str, length) {
return str.match(new RegExp('.{1,' + length + '}', 'g'));
}
@leogdion
leogdion / git-submodule-foreach.zsh
Last active March 15, 2017 14:42
git submodule foreach aliases
function __git_submodule_foreach_commit () {
git submodule foreach "git commit -am $1" && git commit -am $1
}
function __git_submodule_foreach_push () {
git submodule foreach "git push" && git push
}
function __git_submodule_foreach_pull () {
git submodule foreach "git pull" && git pull
@leogdion
leogdion / Bundle.RegisterFonts.swift
Created December 2, 2016 20:36
How to register fonts in a Bundle without having to edit the plist
//
// Bundle.swift
// timerany
//
// Created by Leo Dion on 12/2/16.
// Copyright © 2016 BrightDigit. All rights reserved.
//
import Foundation
import CoreGraphics
@leogdion
leogdion / serialNumber.swift
Created October 18, 2016 14:25
How To Get A Serial Number on macOS in Swift
var serialNumber: String? {
let platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice") )
guard platformExpert > 0 else {
return nil
}
guard let serialNumber = (IORegistryEntryCreateCFProperty(platformExpert, kIOPlatformSerialNumberKey as CFString, kCFAllocatorDefault, 0).takeUnretainedValue() as? String)?.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) else {
return nil
}
@leogdion
leogdion / index.js
Created September 8, 2016 00:02
Finding The Earliest Date Available Based On Time Slots
console.log("hello world");

Keybase proof

I hereby claim:

  • I am leogdion on github.
  • I am leogdion (https://keybase.io/leogdion) on keybase.
  • I have a public key whose fingerprint is 85D8 5DAF 9102 74F8 0106 1C1E 7BE6 BF0D 1B27 893A

To claim this, I am signing this object:

cd ~
mkdir -p ~/.nave
mkdir -p ~/.scripts
mkdir -p ~/.installation
# Download scripts
cd ~/.scripts
curl -o backup-wpdb.sh https://gist.github.com/leogdion/8343509/raw
curl -o hostnames.sh https://gist.github.com/leogdion/8226872/raw
curl -o /etc/profile.d/sudoscreen.sh https://gist.github.com/leogdion/8442367/raw
# Download nave script
alias sudoscreen='sudo PATH=$PATH screen'
#!/bin/bash
function var() {
eval $2=`grep -Po "define\('$3',\s*'(\K[^']+)" $1 | head -n 1`
}
wp_config=$1
base_dir=$2
date_prefix=$(date -u +"%y%m%d%H")