Skip to content

Instantly share code, notes, and snippets.

View gonelf's full-sized avatar
🏠
Working from home

Gonçalo Henriques gonelf

🏠
Working from home
View GitHub Profile
javascript: (function() {
var url = prompt('URL of CSS to inject:', '');
if (url) {
console.log('CSS inject request URL:', url);
var link = document.createElement('link');
link.href = url;
@gonelf
gonelf / bookmarklet_inject_script_to_page.js
Created July 15, 2021 11:03 — forked from midlan/bookmarklet_inject_script_to_page.js
Bookmarklet to inject script by url to page, e.g. jquery.
javascript: (function() {
var url = prompt('URL of script to inject:', 'https://code.jquery.com/jquery-3.4.1.min.js');
if (url) {
console.log('Script inject request URL:', url);
var script = document.createElement('script');
script.src = url;
@gonelf
gonelf / Jira - Original estimates sums.user.js
Last active October 30, 2019 17:16
Tempermonkey, Jira - Original estimate sums
// ==UserScript==
// @name Jira - Original estimate sum (original)
// @namespace http://tampermonkey.net/
// @version 0.2
// @description See Original and Remaning Sums
// @author You
// @match http://bit-develop-01.brisa.pt/jira/issues/*
// @grant none
// ==/UserScript==
// @require http://code.jquery.com/jquery-3.4.1.min.js
This file has been truncated, but you can view the full file.
[
{
"name": "HASH KEY",
"unified": "0023-FE0F-20E3",
"non_qualified": "0023-20E3",
"docomo": "E6E0",
"au": "EB84",
"softbank": "E210",
"google": "FE82C",
"image": "0023-fe0f-20e3.png",
@gonelf
gonelf / UIColor+Hex.swift
Created May 27, 2015 14:56
UIColor + Hexadecimal
extension UIColor {
convenience init(hex: String) {
var red: CGFloat = 0.0
var green: CGFloat = 0.0
var blue: CGFloat = 0.0
var alpha: CGFloat = 1.0
if hex.hasPrefix("#") {
let index = advance(hex.startIndex, 1)
let _hex = hex.substringFromIndex(index)
@gonelf
gonelf / UIButton.swift
Created May 27, 2015 14:55
UIButton center text with image (extension)
import UIKit
extension UIButton {
func centerTextWithImage (margin:CGFloat) {
var width = self.frame.width
var imgWidth = self.imageView!.frame.width as CGFloat
var txt = self.titleLabel!.text
var textSize = self.titleLabel!.sizeOfString(txt!, height: Double(self.frame.height)) as CGSize
@gonelf
gonelf / countryName.swift
Created May 27, 2015 14:51
Swift Country Name
func getCountryName () -> String {
let locale = NSLocale.currentLocale()
let countryCode = locale.objectForKey(NSLocaleCountryCode) as! String
let usLocale = NSLocale(localeIdentifier: "en_US")
let country = usLocale.displayNameForKey(NSLocaleCountryCode, value: countryCode)
return country!
}