Skip to content

Instantly share code, notes, and snippets.

View pinchez254's full-sized avatar
💻
Stop saying and start doing

Peter Mugendi pinchez254

💻
Stop saying and start doing
View GitHub Profile
@pinchez254
pinchez254 / score.js
Last active November 27, 2022 23:14
Given an array of integers, keep a total score based on the following; 1. Add 1 point for every even number in an array. 2. Add 3 points for every number in the array. 3 Add 5 points for every time you encounter 5 in the array. leave a star if this helped you
export function find_total( my_numbers ) {
//Insert your code here
let score = 0
my_numbers.forEach((x)=>{
if(x%2==0){
score = score + 1
}else if(x % 2 != 0 && x !== 5){
score = score + 3
}else{
@pinchez254
pinchez254 / semantic-commit-messages.md
Last active August 2, 2023 03:20
simple semantic commit messages for productivity

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@pinchez254
pinchez254 / FizzBuzz.js
Last active July 31, 2019 09:39
solving Fizz Buzz with JavaScript. Task: Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.
// fizz buzz
for (a=1 ; a < 101 ; a ++){
a % 15 == 0
? console.log('fizzBuzz')
: a % 3 === 0
? console.log('fizz')
: a % 5 === 0
? console.log('Buzz')
: console.log(a)
}
@gadzhimari
gadzhimari / adobe_cc.md
Created November 22, 2018 11:29
Completely Remove Adobe from your Mac in 2 Steps

Step 1

Download and run the Adobe Creative Cloud Cleaner Tool, their multi-app uninstaller and wipe assistant. Adobe does recommend running individual application uninstallers first, your call. Click the Clean All option.

Step 2

Type a one line command in terminal find ~/ -iname "*adobe*" and it's shows up all files which match pattern.

To remove all files

`sudo rm -rf /Applications/Adobe* /Applications/Utilities/Adobe* /Library/Application\ Support/Adobe /Library/Preferences/com.adobe.* /Library/PrivilegedHelperTools/com.adobe.* /private/var/db/receipts/com.adobe.* ~/Library/Application\ Support/Adobe* ~/Library/Application\ Support/com.apple.sharedfilelist/com.apple.LSSharedFileList.ApplicationRecentDocuments/com.adobe* ~/Library/Application\ Support/CrashReporter/Adobe* ~/Library/Caches/Adobe ~/Library/Caches/com.Adobe.* ~/Library/Caches/com.adobe.* ~/Library/Cookies/com.adobe.* ~/Library/Logs/Adobe* ~/Librar

@jamielob
jamielob / upload.js
Created October 18, 2016 23:07 — forked from cmcewen/upload.js
Upload image from React Native to Cloudinary
var CryptoJS = require('crypto-js');
function uploadImage(uri) {
let timestamp = (Date.now() / 1000 | 0).toString();
let api_key = 'your api key'
let api_secret = 'your api secret'
let cloud = 'your cloud name'
let hash_string = 'timestamp=' + timestamp + api_secret
let signature = CryptoJS.SHA1(hash_string).toString();
let upload_url = 'https://api.cloudinary.com/v1_1/' + cloud + '/image/upload'
@arneschreuder
arneschreuder / GBestPSO.py
Last active December 7, 2018 08:38
Global Best Particle Swarm Optimisation (PSO) in 100 lines of Python code.
# IMPORTS
from random import uniform
from copy import deepcopy
# TUNABLE CONSTANTS
swarm_size = 10
w = 0.729844
c1 = 1.496180
c2 = 1.496180