Skip to content

Instantly share code, notes, and snippets.

View rfsbsb's full-sized avatar

Rafael Silva rfsbsb

View GitHub Profile
@jerrylow
jerrylow / pure-css-donut-chart.scss
Last active June 21, 2021 18:57
Pure CSS Donut Chart Mixin
// Pure CSS Donut Chart
// By: Jerry Low
// How to use sample: https://codepen.io/jerrylow/pen/KKdNXbJ
.donut {
--donut-size: 300px;
--donut-border-width: 20px;
--donut-spacing: 0;
--donut-spacing-color: 255, 255, 255;
--donut-spacing-deg: calc(1deg * var(--donut-spacing));
@mlynch
mlynch / info.plist
Last active August 6, 2023 07:31
Disable App Transport Security in iOS 9
<!--
This disables app transport security and allows non-HTTPS requests.
Note: it is not recommended to use non-HTTPS requests for sensitive data. A better
approach is to fix the non-secure resources. However, this patch will work in a pinch.
To apply the fix in your Ionic/Cordova app, edit the file located here:
platforms/ios/MyApp/MyApp-Info.plist
And add this XML right before the end of the file inside of the last </dict> entry:
@Jaesin
Jaesin / rest-request.php
Last active February 23, 2023 10:39
Guzzle 4 in Drupal 8. Get a JSON version of a node.
<?php
// Example using cookie auth.
print (string) \Drupal::httpClient()
->get('http://example.com/node/1', [
'headers' => ['Accept' => 'application/json'],
'cookies' => ['SESS07e0668737e9f97189850d2cf0c79892' => 'dasGegKQ6ZzEF0xvRZWWzwrl9tt7UT8fGuXrAeLC9P1'],
])
->getBody(TRUE);
@jonasruth
jonasruth / paises-gentilicos-google-maps.json
Last active December 25, 2023 23:55
JSON com lista de Países em pt-BR e seus respectivos Gentílicos, Siglas e Nome Internacional - Possui todos os países do Google Maps
[ { "gentilico" : "afegãne",
"nome_pais" : "Afeganistão",
"nome_pais_int" : "Afghanistan",
"sigla" : "AF"
},
{ "gentilico" : "sul-africana",
"nome_pais" : "África do Sul",
"nome_pais_int" : "South Africa",
"sigla" : "ZA"
},
@scottdelly
scottdelly / FacebookLogin.swift
Last active April 23, 2021 21:43
Facebook Login with iOS SDK 4.0 in Swift
//If you have a Bridging-Header:
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
//In your AppDelegate:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [String: AnyObject]?) -> Bool {
//App launch code
FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
//Optionally add to ensure your credentials are valid:
@jamiemagique
jamiemagique / template.php
Last active February 27, 2019 15:23
Drupal 7 - Render an image using the picture module mappings programatically (via preprocess_node() in this gist)
// Get image settings array from a field on the node
$image = field_get_items('node', $node, 'INSERT_IMAGE_FIELD_MACHINE_NAME');
// Picture settings
$picture_mapping = picture_mapping_load('INSERT_PICTURE_MAPPING_MACHINE_NAME');
$fallback = 'INSERT_IMAGE_STYLE_MACHINE_NAME';
$breakpoints = picture_get_mapping_breakpoints($picture_mapping, $fallback);
// Create a new variable to pass through to the node template
$variables['INSERT_NEW_VARIABLE_NAME_TO_PASS_TO_NODE_TEMPLATE'] = theme('picture', array('uri' => $image[0]['uri'], 'style_name' => $fallback, 'breakpoints' => $breakpoints));
@justinmakaila
justinmakaila / APIRoute.swift
Created February 6, 2015 16:32
Alamofire API Route Protocol
/**
An API Route
*/
protocol APIRoute {
var method: Alamofire.Method { get }
var encoding: Alamofire.ParameterEncoding { get }
var path: String { get }
var parameters: [String: AnyObject]? { get }
var requestConvertible: APIRequestConvertible { get }
}
@flavio88
flavio88 / DropdownTableViewController.h
Last active August 29, 2015 14:13
Como criar um elemento "Dropdown" no IOS
// DropdownTableViewController.h
#import <UIKit/UIKit.h>
//Declaração do delegate que deve ser implementado por quem importar
//Se quiser, você pode criar métodos opcionais colocando abaixo de @optional
@protocol DropdownDelegate <NSObject>
- (void)setField:(NSString *)texto withValue:(NSNumber *)valor;
heights = [2, 5, 1, 2, 3, 4, 7, 7, 6]
totalWater = 0
for index in range(0, len(heights)):
currentHeight = heights[index]
maxLeftHeight = max(heights[:index]) if index > 0 else 0
maxRightHeight = max(heights[index:])
smallestMaxHeight = min(maxLeftHeight, maxRightHeight)
water = smallestMaxHeight - currentHeight if smallestMaxHeight - currentHeight > 0 else 0
@jayj
jayj / flexbox.less
Last active November 20, 2023 04:51
CSS3 Flexbox - LESS Mixins
// --------------------------------------------------
// Flexbox LESS mixins
// The spec: http://www.w3.org/TR/css3-flexbox
// --------------------------------------------------
// Flexbox display
// flex or inline-flex
.flex-display(@display: flex) {
display: ~"-webkit-@{display}";
display: ~"-ms-@{display}box"; // IE10 uses -ms-flexbox