Skip to content

Instantly share code, notes, and snippets.

View hectorddmx's full-sized avatar
🎏
On the wind

Hector De Diego hectorddmx

🎏
On the wind
View GitHub Profile
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@hectorddmx
hectorddmx / detect-js-framework.js
Created December 6, 2017 23:04 — forked from rambabusaravanan/detect-js-framework.js
Detect JS Framework used in a Website
// Pase these lines into website's console ( Ctrl/Cmd + Shift + I )
if(!!window.React ||
!!document.querySelector('[data-reactroot], [data-reactid]'))
console.log('React.js');
if(!!window.angular ||
!!document.querySelector('.ng-binding, [ng-app], [data-ng-app], [ng-controller], [data-ng-controller], [ng-repeat], [data-ng-repeat]') ||
!!document.querySelector('script[src*="angular.js"], script[src*="angular.min.js"]'))
console.log('Angular.js');
@hectorddmx
hectorddmx / Elixir Email Validation
Last active March 8, 2018 07:14 — forked from mgamini/Elixir Email Validation
Elixir Email Validation
defmodule EmailValidator do
# ensure that the email looks valid
def validate_email(email) when is_binary(email) do
case Regex.run(~r/^[A-Za-z0-9._%+-+']+@[A-Za-z0-9.-]+\.[A-Za-z]+$/, email) do
nil ->
{:error, "Invalid email"}
[email] ->
try do
Regex.run(~r/(\w+)@([\w.]+)/, email) |> validate_email
@hectorddmx
hectorddmx / run phoenix on amazon linux.sh
Last active March 9, 2018 05:43 — forked from eikes/run phoenix on amazon linux.sh
run phoenix on amazon linux
export LANG="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
cd /
# app deps
yum install git -y
# erlang deps
@hectorddmx
hectorddmx / install_pyenv.sh
Created April 8, 2018 23:43 — forked from ysaotome/install_pyenv.sh
pyenv install for CentOS 6.5 x86_64
#!/bin/zsh
# pyenv install for CentOS 6.5 x86_64
yum install -y gcc gcc-c++ make git patch openssl-devel zlib-devel readline-devel sqlite-devel bzip2-devel
git clone git://github.com/yyuu/pyenv.git ~/.pyenv
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
@hectorddmx
hectorddmx / Fonts.swift
Created April 23, 2018 04:58 — forked from feighter09/Fonts.swift
Set global font for iOS app in one place
// MARK: - Swizzling
extension UIFont {
class var defaultFontFamily: String { return "Georgia" }
override public class func initialize()
{
if self == UIFont.self {
swizzleSystemFont()
}
}
@hectorddmx
hectorddmx / UIColorExtension.md
Created May 7, 2018 01:55 — forked from bhrott/UIColorExtension.md
Swift 3: Hex UIColor

Extension:

import Foundation
import UIKit

extension UIColor {
    convenience init(hexString: String) {
        let hex = hexString.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)
        var int = UInt32()
 Scanner(string: hex).scanHexInt32(&int)
@hectorddmx
hectorddmx / README.md
Last active September 14, 2018 19:23 — forked from guilhermearaujo/README.md
OCLint integration with Xcode

OCLint (0.13) integration with Xcode

1. Integration

  • Add a new Target of kind Aggregate, name it OCLint
  • Under Builde Phases, add a new Run Script Phase
  • Paste the script

2. Usage

  • Select target OCLint
  • Build the target (press ⌘+B)
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)
@hectorddmx
hectorddmx / Disable iOS Simulator Incoming Connections Popup.sh
Created September 9, 2020 16:15 — forked from TomSoderling/Disable iOS Simulator Incoming Connections Popup.sh
Bash script for turning off the iOS simulator pop-up message
#!/bin/bash
# Script to disable the iOS Simulator app from showing the "Do you want the application xxxx to accept incoming network connections?" pop-up every time the app is run
echo "> Enter password to temporarily shut firewall off"
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off
echo "> Add Xcode as a firewall exception"
/usr/libexec/ApplicationFirewall/socketfilterfw --add /Applications/Xcode.app/Contents/MacOS/Xcode