Skip to content

Instantly share code, notes, and snippets.

@GuillaumeJasmin
GuillaumeJasmin / extract.js
Last active September 26, 2022 04:10
Extract substring between two strings
String.prototype.extract = function(prefix, suffix) {
s = this;
var i = s.indexOf(prefix);
if (i >= 0) {
s = s.substring(i + prefix.length);
}
else {
return '';
}
if (suffix) {
@MagnusNordin
MagnusNordin / Badge.swift
Last active December 22, 2022 09:38 — forked from yonat/Badge.swift
Rounded UILabel and UIButton, Badged UIBarButtonItem
//
// Badge.swift
// Extensions for Rounded UILabel and UIButton, Badged UIBarButtonItem.
//
// Usage:
// let label = UILabel(badgeText: "Rounded Label");
// let button = UIButton(type: .System); button.rounded = true
// let barButton = UIBarButtonItem(badge: "42", title: "How Many Roads", target: self, action: "answer")
//
// Created by Yonat Sharon on 06.04.2015.
@nitrag
nitrag / Screenshot.swift
Created November 21, 2016 05:16
This will allow you to take a screenshot of a UIView, but more importantly only a section of that view
//
// Screenshot.swift
//
// 1) Take a picture of a UIView
// 2) Take a picture of a UIView's subframe. EG. Fullscreen UIView with a
// small square box in the middle, it will only save what's visible in the box frame
// but not the box itself
import Foundation
import UIKit
@nonamelive
nonamelive / DMNavigationController.m
Last active April 21, 2023 06:56
Prevent UINavigationController from pushing two view controllers at the same time in case of stack inconsistency and crashes
@interface UINavigationController (DMNavigationController)
- (void)didShowViewController:(UIViewController *)viewController animated:(BOOL)animated;
@end
@interface DMNavigationController ()
@property (nonatomic, assign) BOOL shouldIgnorePushingViewControllers;
@richardtape
richardtape / install-oh-my-zsh-on-ubuntu
Created August 4, 2014 01:58
Install Oh My ZSH on Ubuntu 14.04
# Where is the location of your current shall. Useful if we need to revert
echo $0
# Install ZSH
sudo apt-get install zsh
# Instal GIT
sudo apt-get install git-core
# Install OhMyZSH
@Guichaguri
Guichaguri / Consulta-CNPJ-CEP.md
Last active July 10, 2023 19:57
Consulta CNPJ e CEP - Javascript

Consulta de CNPJ e CEP em Javascript (Web ou NodeJS)

Funções para consultar informações sobre CNPJ e CEP pela web (sem backend necessário) ou através de Node.JS

  • nodejs-lib.js - Código para realizar a requisição através do módulo de HTTPS do Node.JS
  • web-lib.js - Código para realizar a requisição através de JSONP na Web
  • consulta.js - Funções para realizar consultas de CNPJ e CEP

Se você está usando Node.JS, adicione o código de nodejs-lib.js.

@rodrigomanhaes
rodrigomanhaes / capitulo1.rst
Created June 17, 2012 17:46
Resumo do livro Agile Estimating and Planning, de Mike Cohn

AGILE ESTIMATING AND PLANNING

Mike Cohn

CHAPTER 1. The Purpose of Planning

Plans help to guide investment decisions (this project is worth to begin?), know who needs to be available to work on a project during a given period and know if a project is on track.

@cbosco
cbosco / all_my_facebook_photos.html
Last active November 9, 2023 23:34
Simple "get all of my facebook photos" facebook JS SDK + Graph API example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Photos with Friends!</title>
<script src="http://code.jquery.com/jquery-1.9.0.min.js"></script>
<script>
/**
* This is the getPhoto library
*/
@gokulkrishh
gokulkrishh / useful-npx-commands.md
Last active November 24, 2023 04:25
List of useful npx (Node Package Runner) commands (https://git.io/useful-npx-commands)

NPX (NPM Package Runner) Commands

List of useful npx (NPM Package Runner) commands.

What is NPX?

Using NPX we can execute/run node binaries without the need to install it locally or globally.

Commands