Skip to content

Instantly share code, notes, and snippets.

View brunoziie's full-sized avatar

bruno ziiê brunoziie

View GitHub Profile
@evaisse
evaisse / object.toquerystring.js
Last active October 19, 2017 00:09
Object.toQueryString - Vanilla JS version - encode object to POST, GET AJAX calls
/**
* Simply encode a base js object as {a:2, d:[1,"two"], c: {foo: {bar:1}}}
* And returns URL encoded string : a=2&d[0]=1&d[1]=two&c[foo][bar]=1"
*
* @param {Object} object A base javascript object : {}
* @param {String} base Optionnal base notation, should only be used by recursion for internal work
* @return {String} URL encoded query string
*/
Object.toQueryString = function (object, base) {
var queryString = [];
@zxbodya
zxbodya / S3-CORS-config.xml
Last active April 6, 2024 03:40
Client side uploads to s3, with pre-signed upload form (PHP/JS)
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<AllowedOrigin>*</AllowedOrigin>
<AllowedMethod>PUT</AllowedMethod>
<AllowedMethod>POST</AllowedMethod>
<AllowedMethod>GET</AllowedMethod>
<AllowedMethod>HEAD</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<AllowedHeader>*</AllowedHeader>
@programmation
programmation / tabbed_icon_renderer.cs
Created May 4, 2015 04:21
Xamarin Forms Android Tab Bar with Icons
// https://forums.xamarin.com/discussion/comment/119662/#Comment_119662
public class IconTabbedRenderer : TabbedRenderer
{
protected override void DispatchDraw(
global::Android.Graphics.Canvas canvas)
{
base.DispatchDraw(canvas);
SetTabIcons();
@su-narthur
su-narthur / svg-extract.py
Last active May 9, 2022 13:29
Convert SVG font to individual SVG files
# http://helpfulsheep.com/2015-03-25-converting-svg-fonts-to-svg/
import sys, re
if len(sys.argv) < 2:
print 'Usage: python {} webfont-file.svg'.format(sys.argv[0])
sys.exit()
with open(sys.argv[1], 'r') as r:
lines = r.read().split('\n')
glyphs = [x for x in lines if '<glyph' in x]
@marcel-ploch
marcel-ploch / keyboardevents.js
Last active October 11, 2019 10:40
Keyboard Events for IOs in NativeScript
// Keyboard up event on ios
if (application.ios) {
// First Event is Catched before the Keyboard Jumps Up
// We Save the Height of the Keyboard for the Positioning of the LayoutElement
application.ios.addNotificationObserver(UIKeyboardWillShowNotification, (event) => {
// console.log('WillShow', typeof event.userInfo, event.userInfo.valueForKey(UIKeyboardFrameEndUserInfoKey).CGRectValue.size.height);
// console.log(this.textView.ios.contentSize);
this.contentSizeStartValue = event.userInfo.valueForKey(UIKeyboardFrameEndUserInfoKey).CGRectValue.size.height + 10;
});
// Second Event is Catched when the Keyboard is Up to Reposition our Element
const sample = [
[
[
[
[
[
{
foo: [{ rate: 2.18 }],
},
],