Skip to content

Instantly share code, notes, and snippets.

View camiloibarrayepes's full-sized avatar
🏠
Working from home

Camilo Andres Ibarra Yepes camiloibarrayepes

🏠
Working from home
  • Colombia
View GitHub Profile
import SwiftUI
struct ContentView: View {
@State private var moveGradient = true
var body: some View {
slideToPowerOffText(text: "Slide to power off", textColor: .black)
}
import UIKit
let ratings = [4, 8, 9.5, 2,6, 7, 3.5, 5.9, 1.5, 3.3, 9]
let results = ratings.reduce(into [:]) { (results: inout [String: Int], rating: Double) in
switch rating {
case 1..<4: results["Very bad", default: 0] += 1
case 4..<6: results["Ok", default: 0] += 1
case 6..<8: results["Good bad", default: 0] += 1
import UIKit
let urlImages = ["https://applecoding.com/wp-content/uploads/2019/07/cropped-black-and-white-black-and-white-challenge-262488-1024x576.jpg",
"https://applecoding.com/wp-content/uploads/2019/07/cropped-company-concept-creative-7369-1-1024x575.jpg",
"https://applecoding.com/wp-content/uploads/2018/06/cropped-mapkitjs-portada-1024x576.jpg",
"https://applecoding.com/wp-content/uploads/2019/06/combine-operators-1024x573-1024x576.jpg",
"https://applecoding.com/wp-content/uploads/2019/06/wwdc_2_0.jpg",
"https://applecoding.com/wp-content/uploads/2018/06/header-390x220.jpg",
"https://applecoding.com/wp-content/uploads/2018/06/mapkitjs-portada-1024x576.jpg"]
// Set blur gaussian effect to a UIView
let visualEffectView = UIVisualEffectView(effect: nil)
let totalContainerView = UIView()
let animator = UIViewPropertyAnimator(duration: 0.5, curve: .linear)
self.view.setBlurEffectGeneral(mainView: self.view,
animator: animator,
totalContainer: totalContainerView,
visualEffect: visualEffectView)
//decimal
let decimalNumber = 17
//Binario
let decimalBinario = 0b10001 // 16*1 + 8*0 + 4*0 + 2*2 + 1*1 + = 17 Binario
//Octal
let decimalOctal = 0o21 //8*2 + 1*1
//hexadecimal
let decimalHexa = 0x11 //16*1+1
let number = 1.25e2 //1.25*10^2
//
// LocalNotificationsController.swift
//
import Foundation
import UserNotifications
class LocalNotificationsController {
init() {
let center = UNUserNotificationCenter.current()
@camiloibarrayepes
camiloibarrayepes / deepLinkRN.js
Created March 11, 2019 04:03
Deep Link React Native Example
import React from 'react';
import {Platform, View, Linking,} from 'react-native';
export default class deepLinkRN extends React.Component {
constructor(props){
super(props)
this.state = { }
}
@camiloibarrayepes
camiloibarrayepes / gist:1cbda389d6d0a107e7d6afc5653d9cc1
Created August 2, 2018 19:52
ScrollBar/ScrollIndicator React Native
/*--------- variable ----------*/
this.state={varScroll:false}
/*-------- Functions ----------*/
setvarScrollState() {
this.setState({VarScroll: true});
}
@camiloibarrayepes
camiloibarrayepes / .htaccess
Created June 19, 2018 02:36
Redirect php url friendly getting id and showing name or username
RewriteEngine On
Options +FollowSymLinks
#Allow '-' and letters/numbers
RewriteRule ^([a-zA-Z0-9]+)/([a-zA-Z0-9-]+)$ b_user.php?view=$1&name=$2
RewriteRule ^([a-zA-Z0-9]+)$ b_user.php?view=$1
RewriteRule ^([^\.]+)$ $1.php [NC,L]
@camiloibarrayepes
camiloibarrayepes / jqueryvalidation.js
Last active June 19, 2018 02:31
Special Characters Jquery Validation
jQuery.validator.addMethod("nameRegex", function(value, element) {
return this.optional(element) || /^[a-z\ \s]+$/i.test(value);
}, "Name must contain only letters & space");
jQuery("#empform").validate({
rules :{
'name':{
required:true,
nameRegex:true