Skip to content

Instantly share code, notes, and snippets.

View klebercode's full-sized avatar
🎯
Focusing

Kleber Soares klebercode

🎯
Focusing
View GitHub Profile
@rturowicz
rturowicz / page.py
Last active December 19, 2018 11:50
django - intermediate admin page
# admin.py: admin action definition
def make_copy(self, request, queryset):
form = None
if 'apply' in request.POST:
form = CopyPageForm(request.POST)
if form.is_valid():
issue = form.cleaned_data['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
@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
@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';
@pebreo
pebreo / django-jquery-demo.py
Last active April 29, 2020 05:15
jQuery AJAX + Django SIMPLE DEMO
# views.py - django app called ajx
from django.shortcuts import render, get_object_or_404, redirect, HttpResponse, render_to_response, HttpResponseRedirect
from django.core.urlresolvers import reverse
from django.contrib.auth import authenticate, login
import json
def mygetview(request):
if request.method == 'GET':
#!/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" ]
@Manduro
Manduro / keyboard-attach.directive.ts
Last active August 24, 2020 06:50
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 { Subscription } from 'rxjs/Subscription';
/**
* @name KeyboardAttachDirective
* @source https://gist.github.com/Manduro/bc121fd39f21558df2a952b39e907754
* @description
#!/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
@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';
@fer-ri
fer-ri / background-image.ts
Created May 24, 2016 06:33
Background Image Style Directive for Angular 2 and Ionic 2
import {Directive, ElementRef, Input} from '@angular/core';
@Directive({
selector: '[background-image]'
})
export class BackgroundImage {
private el: HTMLElement;
constructor(el: ElementRef) {
this.el = el.nativeElement;