Skip to content

Instantly share code, notes, and snippets.

View usmanbashir's full-sized avatar

Usman Bashir usmanbashir

View GitHub Profile
@usmanbashir
usmanbashir / Helpers.js
Created May 20, 2018 15:46
Experimenting a different style of programming. Where every validation method on success calls a function with the said data as an argument.
export const toProperCase = (string) => {
return (
string.charAt(0).toUpperCase() + string.toLowerCase().substr(1)
)
}
// Usecase:
// isNotEmptyString(firstName, (firstName) => { // do something... }
//
export const isNotEmptyString = (variable, func) => {
@usmanbashir
usmanbashir / handleAdopt.js
Created April 27, 2018 21:47
How To Write A Smart Contract - Blockchain Day @ Wadi Makkah
handleAdopt: function(event) {
event.preventDefault();
var petId = parseInt($(event.target).data('id'));
var adoptionInstance;
web3.eth.getAccounts(function(error, accounts) {
if (error) {
console.log(error);
@usmanbashir
usmanbashir / shirt
Created January 19, 2015 15:01
A Unix Shell In Ruby
#!/usr/bin/env ruby
require 'shellwords'
def main
loop do
$stdout.print ENV['PROMPT']
line = $stdin.gets
if line
line.strip!
@usmanbashir
usmanbashir / chef-solo-bootstrap.sh
Last active August 29, 2015 14:00
Bootstrap Ruby & Chef Solo for Ubuntu
#!/usr/bin/env bash
if which chef-solo; then
echo "Chef already seems to be installed on the system.";
else
# Resynchronize the package index.
apt-get -y update
# Install build essential packages.
sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-dev libyaml-dev libcurl4-openssl-dev curl

Keybase proof

I hereby claim:

  • I am usmanbashir on github.
  • I am usmanbashir (https://keybase.io/usmanbashir) on keybase.
  • I have a public key whose fingerprint is B865 3A9E D803 6D25 5D2E 3842 8BC6 025E DB18 E9B7

To claim this, I am signing this object:

<?php
$sMailTo = "your@email.com";
$sMailSubject = "New Message";
$sMailMessage = "Your message!";
if ( mail($sMailTo, $sMailSubject, $sMailMessage, "From: contact@yourdomain.com") ) {
echo "Thank you for your feedback.";
} else {