Skip to content

Instantly share code, notes, and snippets.

View farskid's full-sized avatar
🎯
Focusing

Farzad Yousefzadeh farskid

🎯
Focusing
View GitHub Profile
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@briancavalier
briancavalier / simple-promise-retry.js
Created February 24, 2011 18:35
A few general patterns for retries using promises
function keepTrying(otherArgs, promise) {
promise = promise||new Promise();
// try doing the important thing
if(success) {
promise.resolve(result);
} else {
setTimeout(function() {
keepTrying(otherArgs, promise);
@ocean90
ocean90 / box-shadow.html
Last active April 11, 2024 13:54
CSS3 Box Shadow, only top/right/bottom/left and all
<!DOCTYPE html>
<html>
<head>
<title>Box Shadow</title>
<style>
.box {
height: 150px;
width: 300px;
margin: 20px;
@taterbase
taterbase / system-beep.js
Created July 21, 2012 05:01
System Beep in Node.js
function alertTerminal(){
console.log("\007");
}
@AliMD
AliMD / gist:3344523
Created August 13, 2012 22:28
All github Emoji (Smiles)

All github Emoji (Smiles)

ali.md/emoji

:bowtie: | 😄 | 😆 | 😊 | 😃 | ☺️ | 😏 | 😍 | 😘 | :kissing_face: | 😳 | 😌 | 😆 | 😁 | 😉 | :wink2: | 👅 | 😒 | 😅 | 😓

😩 | 😔 | 😞 | 😖 | 😨 | 😰 | 😣 | 😢 | 😭 | 😂 | 😲 | 😱 | :neckbeard: | 😫 | 😠 | 😡 | 😤 | 😪 | 😋 | 😷

😎 | 😵 | 👿 | 😈 | 😐 | 😶 | 😇 | 👽 | 💛 | 💙 | 💜 | ❤️ | 💚 | 💔 | 💓 | 💗 | 💕 | 💞 | 💘 | ✨

@cliffparnitzky
cliffparnitzky / create_github_tag.sh
Last active December 18, 2020 22:10
Simple way to create a tag via git shell and push it to repo
# creat a tag (more infos at: http://git-scm.com/book/de/ch2-12.html)
git tag -a 1.0.0 -m "Version 1.0.0"
git push origin 1.0.0
git tag -a 1.0.0.alpha1 -m "Version 1.0.0 alpha1"
git push origin 1.0.0.alpha1
# delete a tag
git tag -d 1.0.0
git push origin :refs/tags/1.0.0
@Integralist
Integralist / Strategy.js
Created June 8, 2013 20:16
Strategy Design Pattern in JavaScript
// Greeter is a class of object that can greet people.
// It can learn different ways of greeting people through
// 'Strategies.'
//
// This is the Greeter constructor.
var Greeter = function(strategy) {
this.strategy = strategy;
};
// Greeter provides a greet function that is going to
@paulirish
paulirish / what-forces-layout.md
Last active June 8, 2024 13:18
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@TiagoGouvea
TiagoGouvea / index.android.js
Created October 10, 2015 16:12
Sample DrawerLayout opened by clicking in a TouchableHighlight component
/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
@sonyseng
sonyseng / TreeIterator.js
Last active December 9, 2023 08:49
Playing around with the Iterators from ES6 to walk a tree non-recursively (babeljs)
// Test tree with contrived data
let testTree = {
value: 1,
child: [
{value: 2, child: [
{value: 7, child: []},
{value: 8, child: []},
{value: 9, child: []},
]},
{value: 3, child: []},