Skip to content

Instantly share code, notes, and snippets.

View azhararmar's full-sized avatar

Ibrahim Azhar Armar azhararmar

View GitHub Profile
@heaversm
heaversm / react_to_google_sheets_form.js
Created July 2, 2019 11:05
Storing form data from a website in Google Spreadsheets using javascript
import { Form, Text } from 'informed'; //https://joepuzzo.github.io/informed/
import React from 'react';
const SPREADSHEET_ID = 'nhlD3E6xsi2lbDQ71HTJ3oQ1Ql5dIkuiK4IoZYjHD'; //from the URL of your blank Google Sheet
const CLIENT_ID = '2d280542491u-3aofp4eFeftog7q0u5a73ro566h8vi.apps.googleusercontent.com'; //from https://console.developers.google.com/apis/credentials
const API_KEY = 'AIzaSyCz5fYFuCORKGXSGu4IwKq4U_HfcdDtB'; //https://console.developers.google.com/apis/credentials
const SCOPE = 'https://www.googleapis.com/auth/spreadsheets';
export default class ContactForm extends React.Component {
@srmds
srmds / Installing wkhtmltopdf 0.12.6, 0.12.5, 0.12.4 - Ubuntu 22.06 , 18.04, 16.04 x64, 0.12.6 - MacOS Ventura 13.6.md
Last active February 16, 2024 13:54
Installing wkhtmltopdf 0.12.4, 0.12.5 0.12.6 - Ubuntu 22.04 - 0.12.6, 16.04 x64, 0.12.5 - Ubuntu 18.04 x64 - 0.12.5 - macOS Ventura -13.6
@geerteltink
geerteltink / SymfonyCustomFormTypeWithValidation.php
Last active February 13, 2022 21:25
Symfony 3 forms validation constraints without an entity
<?php
// ...
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
<?php
/**
* Product attributes
*
* Used by list_attributes() in the products class
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.1.3
*/
@imcarvalho
imcarvalho / install_php_extensions_mac_mamp.md
Last active May 10, 2018 10:46
Install extensions on MAMP 3.5 and Mac OSX 10.11 tutorial

I'm using PHP 5.6.10, and trying to install the memcache extension. You can adapt this to other PHP versions and to other extensions, of course 😄

  • Download the version of PHP you're using from php.net.
  • At /Applications/MAMP/bin/php/php5.6.10, create a directory named include.
  • Inside /Applications/MAMP/bin/php/php5.6.10/include (your newly created folder), untar the php file you downloaded from php.net.
  • For me, it produced a folder named "php-5.6.10". Rename it to "php". Now you'll have this structure: /Applications/MAMP/bin/php/php5.6.10/include/php
  • Go to that folder on terminal, and run ./configure
  • Then, go to /Applications/MAMP/bin/php/php5.6.10/include/php/bin
  • Run, for instance: sudo /Applications/MAMP/bin/php/php5.6.10/bin/pecl install memcache
  • Afterwards, edit your php.ini file (/Applications/MAMP/bin/php/php5.6.10/conf/php.ini), and add the line extension=memcache.so
@timersys
timersys / mamp-curl
Created February 9, 2015 23:01
Update MAMP / MAMP pro Curl
download curl from http://ftp.sunet.se/pub/www/utilities/curl/curl-7.40.0.tar.bz2
Configure it with ./configure --prefix=/Applications/MAMP/Library/
make && make install
@ssskip
ssskip / ISO3166-1.alpha2.json
Last active May 1, 2024 09:36
json of country codes (ISO 3166-1 alpha-2) and corresponding names
{
"AF": "Afghanistan",
"AX": "Aland Islands",
"AL": "Albania",
"DZ": "Algeria",
"AS": "American Samoa",
"AD": "Andorra",
"AO": "Angola",
"AI": "Anguilla",
"AQ": "Antarctica",
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@JosefJezek
JosefJezek / setup-msmtp-for-gmail.sh
Last active August 14, 2022 11:44
Sending emails using Gmail and msmtp on Ubuntu / Debian
#!/bin/sh
# Sending emails using Gmail and msmtp
# Author: [Josef Jezek](http://about.me/josefjezek)
# Donate: [Gittip](https://www.gittip.com/josefjezek)
# Link: [Gist](https://gist.github.com/6194563)
# Usage: setup-msmtp-for-gmail.sh
sudo apt-get update -q
sudo apt-get install msmtp-mta ca-certificates heirloom-mailx -yq
@georgybu
georgybu / content-single-product.php
Created December 14, 2012 12:09
WooCommerce - Show next\prev products from current product category (when viewing a single product) 1. If product is last -> Next product is first 2. If product is first -> Prev product is last forked from https://gist.github.com/2176823 (This question was in http://stackoverflow.com/questions/13597687/woocommerce-get-next-previous-product/13612387
<?php
// get next and prev products
// Author: Georgy Bunin (bunin.co.il@gmail.com)
// forked from https://gist.github.com/2176823
function ShowLinkToProduct($post_id, $categories_as_array, $label) {
// get post according post id
$query_args = array( 'post__in' => array($post_id), 'posts_per_page' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'tax_query' => array(
array(
'taxonomy' => 'product_cat',