Skip to content

Instantly share code, notes, and snippets.

View klebercode's full-sized avatar
🎯
Focusing

Kleber Soares klebercode

🎯
Focusing
View GitHub Profile
@santoshshinde2012
santoshshinde2012 / Build Ionic 2 Cordova Apps For Specific Platform Version (config.xml)
Last active October 8, 2019 14:36
Build Ionic 2 Cordova Apps For Specific Platform Version (config.xml)
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloCordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
#!/bin/bash
command_exists () {
type "$1" &> /dev/null ;
}
export GITHUB_REPO="user/repo"
export GITHUB_USERNAME=$(cat ~/.githubrc 2> /dev/null | grep user.login | cut -d ":" -f2 | xargs)
export GITHUB_PASSWORD=$(cat ~/.githubrc 2> /dev/null | grep user.password | cut -d ":" -f2 | xargs)
if [ -z "$GITHUB_USERNAME" ]
#!/bin/bash
export GITHUB_REPO="user/repo"
export GITHUB_USERNAME=$(cat ~/.githubrc 2> /dev/null | grep user.login | cut -d ":" -f2 | xargs)
export GITHUB_PASSWORD=$(cat ~/.githubrc 2> /dev/null | grep user.password | cut -d ":" -f2 | xargs)
if [ -z "$GITHUB_USERNAME" ]
then
read -p "Type your Github username: " GITHUB_USERNAME
echo "user.login: $GITHUB_USERNAME" >> ~/.githubrc
fi
@tricoder42
tricoder42 / 00_GraphQL_Subscriptions.md
Last active February 22, 2023 12:40
GraphQL Subscriptions with django-channels

GraphQL Subscription with django-channels

Django channels are official way for implementing async messaging in Django.

The primary caveat when working with GraphQL subscription is that we can't serialize message before broadcasting it to Group of subscribers. Each subscriber might use different GraphQL query so we don't know how to serialize instance in advance.

See related issue

@rdlabo
rdlabo / keyboard-attach.directive.ts
Last active September 25, 2019 10:02 — forked from Manduro/keyboard-attach.directive.ts
Ionic Keyboard Attach Directive
import { Directive, ElementRef, Input, OnDestroy, OnInit } from '@angular/core';
import { Keyboard } from '@ionic-native/keyboard';
import { Content, Platform } from 'ionic-angular';
import { Observable } from 'rxjs/Observable';
import { Subscription } from 'rxjs/Subscription';
/**
* @name KeyboardAttachDirective
* @source https://gist.github.com/rdlabo/942671d8c9cffb02676756cdd56aa1c0
* @forked https://gist.github.com/Manduro/bc121fd39f21558df2a952b39e907754
@mbrochh
mbrochh / 01_utils.py
Last active September 24, 2023 10:45
Using pagination with Django, graphene and Apollo
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
# First we create a little helper function, becase we will potentially have many PaginatedTypes
# and we will potentially want to turn many querysets into paginated results:
def get_paginator(qs, page_size, page, paginated_type, **kwargs):
p = Paginator(qs, page_size)
try:
page_obj = p.page(page)
except PageNotAnInteger:
@coolvasanth
coolvasanth / ionic2_upload_file_from_google_drive
Created August 27, 2017 05:59
Uploading a file from google drive/cloud application into your server Ionic, Hybrid app development.
//You need to use html input type file for this purpose.
// INPUT TYPE FILE GIVES A WEIRD LOOK FOR APP SO I HAVE
//STYLED IT LIKE BELOW.
//the html code is as below ex home.html
<label ion-button for="uploadResume" block style="background-color: #16a085;color: white;" color="secondary">Choose Resume</label>
<input style="display: none;" type="file" name="" id="uploadResume" (change)="OnResumeSelect($event)">
@coolvasanth
coolvasanth / uploadingvideo.txt
Created April 25, 2017 07:36
uploading video which is captured from device to server via API (works both on android and ios)
//install media capture, file chooser, file transfer, camera plugins from ionic 2 native plaugins and don't forget to add providers in
app.component.ts
import { Component } from '@angular/core';
import { NavController, NavParams,ActionSheetController } from 'ionic-angular';
import { MediaCapture, MediaFile, CaptureError, CaptureImageOptions,CaptureVideoOptions } from '@ionic-native/media-capture';
import { Camera, CameraOptions } from '@ionic-native/camera';
import { Transfer, FileUploadOptions, TransferObject } from '@ionic-native/transfer';
import { FileChooser } from '@ionic-native/file-chooser';
@coolvasanth
coolvasanth / uploadingresume.txt
Last active April 3, 2020 05:40
choosing .jpg,.pdf,.docs etc files from galley and uploading it to server via your API using IONIC 2. (DOESN'T WORK ON IOS)
// Install file chooser and file transfer API from ionic 2 and import them into your page.ts. and don't forget to add providers in
app.component.ts
import { Component } from '@angular/core';
import { NavController, NavParams} from 'ionic-angular';
import { Home } from '../../homemodule/home';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { UserProfileService } from '../../services/login.service';
@coolvasanth
coolvasanth / takepictureandupload.txt
Last active June 29, 2021 01:02
pick image from gallery or from camera and upload it to server via API, ionic 2
//install camera, file trnasfer plugin from ionic native and it's providers in app.component.ts. then only you can use thse codes in your .ts file.
presentActionSheet() {
let actionSheet = this.actionSheetCtrl.create({
title: 'Pick your profile photo',
buttons: [
{
text: 'From Gallery',