Skip to content

Instantly share code, notes, and snippets.

View designviacode's full-sized avatar
🎯
Focusing

Manpreet Singh designviacode

🎯
Focusing
View GitHub Profile
@designviacode
designviacode / Pulsating Ring Keyframes
Last active August 29, 2015 14:14
A commonly used css-keyframe animation of a pulsating ring.
@-webkit-keyframes pulsate-outer-ring {
0%, 80%, 100% {
transform: none;
-moz-transform: none;
-webkit-transform: none;
opacity: 0;
}
25%,30% {
opacity: 1;
/*
Get Factorial for specified argument to the function
TODO:
check whether the Num is positive, if not;
use another method.
*/
function getFactorial(myNum) {
var factorial = 1;
for(var i=parseInt(myNum); i>0; --i) {
factorial *= i;
@designviacode
designviacode / CharLocation
Created May 31, 2015 10:42
Find character Locations: first-char, last-char, any Index position , index Number in String
/*
*Below Function can find character Locations:
* firstCharacter, lastCharacter, at any Index position
* index Numbers in String
*/
String.prototype.charLocation = function(pos) {
if(pos === 'first' || pos === "f" || pos === "F") {
return this.charAt(0);
}
@designviacode
designviacode / Setup.md
Last active August 29, 2015 14:27 — forked from suvozy/Setup.md
Setup AWS EC2 and RDS (php5.5, apache2.4, mysql5.5, phpmyadmin)
@designviacode
designviacode / BlogController.php
Created March 21, 2016 23:23 — forked from tobysteward/BlogController.php
Laravel AJAX Pagination with JQuery
<?php
class BlogController extends Controller
{
/**
* Posts
*
* @return void
*/
public function showPosts()
@designviacode
designviacode / get_products_of_all_ints_except_at_index.js
Last active July 24, 2016 22:57
Product of all array integers except at Index
<script id="jsbin-source-javascript" type="text/javascript">
/* jshint esnext: true */
let integerArr = [1, 7, 3, 4];
const get_products_of_all_ints_except_at_index = (arr) => {
let result = [];
arr.forEach((crr1, index1) => {
let newVal = 1;
arr.forEach((crr2, index2) => {
@designviacode
designviacode / scale_image_aspect_ratio.js
Created July 24, 2016 23:05
Scale the Aspect ratio of an image to fit inside certain box of 200 x 200 [currently default]
<script id="jsbin-source-javascript" type="text/javascript">
/* jshint esversion: 6 */
let windowSize = 200;
const resize_dimension_aspect_ratio = (w, h) => {
let newValues = [];
let aspectRatio = 0;
if (w > h) {
aspectRatio = Math.round((h / w) * windowSize);
@designviacode
designviacode / README.md
Created August 29, 2016 20:45 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@designviacode
designviacode / index.js
Created January 26, 2017 23:45 — forked from mrzmyr/index.js
React Native - Detect Double Tap
var Index = React.createClass({
getInitialState: function () {
return {
lastPress: 0
}
},
onPress: function () {
var delta = new Date().getTime() - this.state.lastPress;
import React, { Component, PropTypes } from "react";
class SocketProvider extends Component {
constructor(props, context) {
super(props, context);
this.socket = context.socket;
}
render() {
return (