Skip to content

Instantly share code, notes, and snippets.

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

Hashan Shalitha hashaaan

🏠
Working from home
View GitHub Profile
{%comment%}
##################################################
# How To add Coupon Code — Discount Field #
# On Shopify Cart Before Checkout #
# Without Apps #
#################################################
# Paypal Me: https://paypal.me/elghorfimed #
# Buy Me A Coffee: #
# https://www.buymeacoffee.com/elghorfi #
############################################# #
hist = model.fit([Xtrain.book_id, Xtrain.user_id], Xtrain.rating,
batch_size=64,
epochs=5,
verbose=1,
validation_data=([Xtest.book_id, Xtest.user_id], Xtest.rating))
@197291
197291 / ProtectedRoute.jsx
Created July 1, 2019 20:26
Auth HOC, React.js
// Test every passed-in auth verification function.
const verifyAuth = (authCriteria, props) => {
if (authCriteria.length === 0) return true;
return authCriteria.every(criterion => criterion(props));
};
// Authentication HoC
const withAuth = ({
authCriteria = [],
redirectPath = '/',
@rutvikbhatt9
rutvikbhatt9 / .gitlab.ci.yml (react-native)
Created February 11, 2019 05:53
.gitlab.ci.yml file for React-Native
image: openjdk:8-jdk #Defining the Docker Image
variables:
ANDROID_COMPILE_SDK: "28" #set compile SDK version
ANDROID_BUILD_TOOLS: "28.0.2" #set build tool version
ANDROID_SDK_TOOLS: "4333796" #set SDK tool build number you can find yous here https://developer.android.com/studio/releases/sdk-tools
before_script:
# Fetch the specified SDK tools version to build with
- wget --quiet --output-document=/tmp/sdk-tools-linux.zip https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_TOOLS}.zip
@kmuralidharan91
kmuralidharan91 / SearchResultsTableViewController.swift
Created July 25, 2018 06:11
UITableViewController with SearchBar
import UIKit
import SwiftyJSON
import Alamofire
import SafariServices
final class SearchResultsTableViewController: UITableViewController {
private var searchResults = [JSON]() {
didSet {
tableView.reloadData()
@kmuralidharan91
kmuralidharan91 / APIRequestFetcher.swift
Created July 25, 2018 06:00
APIRequestFetcher.swift
import Foundation
import SwiftyJSON
import Alamofire
enum NetworkError: Error {
case failure
case success
}
class APIRequestFetcher {
@akexorcist
akexorcist / index.js
Last active November 17, 2022 11:25
Axios post method requesting with x-www-form-urlencoded content type. See https://axios-http.com/docs/urlencoded
const axios = require('axios')
/* ... */
const params = new URLSearchParams()
params.append('name', 'Akexorcist')
params.append('age', '28')
params.append('position', 'Android Developer')
params.append('description', 'birthdate=25-12-1989&favourite=coding%20coding%20and%20coding&company=Nextzy%20Technologies&website=http://www.akexorcist.com/')
params.append('awesome', true)
@bazadactyl
bazadactyl / install-tf.sh
Created December 13, 2017 22:41
Installing TensorFlow 1.4 (CPU only) from source on Ubuntu 16.04
###################################################################
## Compile and install TensorFlow 1.4 (CPU only) on Ubuntu 16.04 ##
###################################################################
# Install Bazel
sudo apt-get install openjdk-8-jdk -y
echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
sudo apt-get update -y && sudo apt-get install bazel -y
sudo apt-get upgrade bazel -y
@zubaer-ahammed
zubaer-ahammed / Reset MySQL Root Password in Mac OS.md
Last active May 9, 2024 20:47
Reset MySQL Root Password in Mac OS

Reset mysql root password in Mac OS:

First Stop MySQL:

  1. Go to: 'System Preferences' >> 'MySQL' and stop MySQL

OR,

  1. sudo /usr/local/mysql/support-files/mysql.server start
  2. sudo /usr/local/mysql/support-files/mysql.server stop
@BilalBudhani
BilalBudhani / FileUpload.js
Last active September 17, 2023 07:21
Upload Multiple Files To Cloudinary With React & Axios
handleDrop = files => {
// Push all the axios request promise into a single array
const uploaders = files.map(file => {
// Initial FormData
const formData = new FormData();
formData.append("file", file);
formData.append("tags", `codeinfuse, medium, gist`);
formData.append("upload_preset", "pvhilzh7"); // Replace the preset name with your own
formData.append("api_key", "1234567"); // Replace API key with your own Cloudinary key
formData.append("timestamp", (Date.now() / 1000) | 0);