Skip to content

Instantly share code, notes, and snippets.

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

Hovhannes Mkhitaryan OdearOgy

🏠
Working from home
View GitHub Profile
@OdearOgy
OdearOgy / svg_to_react_svg_converter.sh
Created January 7, 2020 22:18
This bash script converts svg files into react native svg file.
# you'll need to install react-native-expo-svg using npm or any other pm
# before running this code
for img in *.svg; do react-native-expo-svg $img; done
@OdearOgy
OdearOgy / deepCopy.js
Last active December 3, 2018 08:20
deep copy function without json.stringify
function iterationCopy(src) {
let target = {};
for (let prop in src) {
if (src.hasOwnProperty(prop)) {
target[prop] = src[prop];
}
}
return target;
}
const source = {a:1, b:2, c:3};
@OdearOgy
OdearOgy / findChars.js
Last active December 3, 2018 08:16
refactored function
function findChars(word, ...letters){
let maxIndex;
if (word.match(/^$/)) {
        return -1;
    }
for(let i = 0; i<letters.length; i++){
if(word.indexOf(letters[i]) != -1){
maxIndex = word.indexOf(letters[i]);
break;
}
@OdearOgy
OdearOgy / PrimesRangeSum.js
Last active November 4, 2018 18:09
this code logs sum of the prime nums in the given range
const reducer = (accumulator, currentValue) => accumulator + currentValue;
function somOfPrimes(range) {
let store = [];
let primes = [];
for (let i = 2; i <= max; ++i) {
if (!store [i]) {
primes.push(i);
for (let j = i << 1; j <= max; j += i) {
// Formats response to look presentable on webpage
const renderResponse = (res) => {
// Handles if res is falsey
if(!res){
console.log(res.status);
}
// In case res comes back as a blank array
if(!res.length){
responseField.innerHTML = "<p>Try again!</p><p>There were no suggestions found!</p>";
return;
@OdearOgy
OdearOgy / pulse-animation.css
Created September 14, 2018 13:05
circle pulse animation
@keyframes circle-beating {
0% {
-webkit-box-shadow: 0 0 0 2px rgba(255, 255, 255, 0);
-moz-box-shadow: 0 0 0 2px rgba(255, 255, 255, 0);
box-shadow: 0 0 0 2px rgba(255, 255, 255, 0);
}
50% {
transition: all .5s linear;
-moz-box-shadow: 0 0 0 10px rgba(255, 255, 255, .5);
@OdearOgy
OdearOgy / common-media-queries.css
Created September 13, 2018 06:56
Common Media Queries
/* This is a small sampling of the various approaches to media queries. The
point is: they're all over the board. Part of the "issue" (if you can call
it that) may be due to the intended audience of each site/framework. Another
may be that it's really difficult to test for a lot of different devices.
Regardless, it would be really nice if there was standard baseline that
could be used as a starting point for maximum compatibility and coverage. */
/* ==========================================================================
Frameworks
========================================================================== */
@OdearOgy
OdearOgy / media-query.css
Created August 18, 2018 19:10 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@OdearOgy
OdearOgy / script.js
Created August 6, 2018 19:16
JavaScript code and simple algorithms
for (var i = 0; i < contacts.length; i++) {
for (var j = 0; j < contacts[i].length; j++) {
console.log(contacts[i][j]);
}
if (contacts.hasOwnProperty(firstName) || contacts.hasOwnProperty(prop)) {
return contacts.prop;
} else if (contacts.hasOwnProperty(firstName) !== true) {
return "No shuch contact"
} else if (contacts.hasOwnProperty(prop) !== true) {
return "No such property";
@OdearOgy
OdearOgy / forkbomb.c
Last active July 9, 2018 11:36
forkbomb on C lang
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
int main() {
int i;
int n = 100000;