Skip to content

Instantly share code, notes, and snippets.

View mfurlend's full-sized avatar

Mikhail Furlender mfurlend

  • WeatherBELL Analytics
  • New York, NY
View GitHub Profile
@mfurlend
mfurlend / key:value => value:key
Created June 6, 2014 14:32
regex for javascript to switch key:value => value:key for objects
search: ([ ]*)(.*?):\s?([^,\n\r]*)
repalce: $1$3:$2
example:
var regionNames = {
"australia":"Australia",
"brazil":"Brazil",
"canada":"Canada",
"caribbean":"Caribbean",
"centamer":"Central America",
@mfurlend
mfurlend / gist:2f3884dd24aa0efcbcb4
Last active August 29, 2015 14:03
Install Python 2.7.6 alongside default on Centos 6.5 x86_64 with conflicting 32 bit libz library in default path, then setup virtualenv and configure a directory
#BUILD AND INSTALL PYTHON
su
yum groupinstall -y development
yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel tk-devel gdbm-devel ncurses-devel readline-develxz-libs
wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz --no-check-certificate
xz -d Python-2.7.6.tar.xz
tar -xvf Python-2.7.6.tar
cd Python-2.7.6
mkdir ~/libzbackup
mv /usr/local/lib/libz* ~/libzbackup

chgrp dev /path/to/dir

chmod -R g+rwxs /path/to/dir

s = SGID

@mfurlend
mfurlend / gist:72de8e155d805ab65c0d
Created October 4, 2014 22:58
ssh tunnel for mysql
ssh -fNg -L 3307:127.0.0.1:3306 user@target_server
@mfurlend
mfurlend / heartbeat
Created November 11, 2014 17:33
heartbeat css3
@-webkit-keyframes heartbeat {
0% { -webkit-transform: scale(1); }
50% { -webkit-transform: scale(0.9); }
100% { -webkit-transform: scale(1); }
}
/* line 88, ../sass/login_header.scss */
#el:hover{
-webkit-animation-name: heartbeat;
-webkit-animation-duration: 200ms;
-webkit-transform-origin:50% 50%;
@mfurlend
mfurlend / gist:e12548d714738daa5b03
Created December 15, 2014 18:52
install PIL on centos
pip install PIL --allow-unverified PIL --allow-all-external
@mfurlend
mfurlend / gist:f5a001e650ac5b8388fd
Created February 10, 2015 20:22
Official RFC email validation regex
(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
@mfurlend
mfurlend / xsl.xsl
Last active August 29, 2015 14:16
XSLT for parsing dwml from forecast.weather.gov
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" encoding="UTF-8" />
<xsl:template name="replace-string">
<xsl:param name="text"/>
<xsl:param name="replace"/>
<xsl:param name="with"/>
<xsl:choose>
<xsl:when test="contains($text,$replace)">
<xsl:value-of select="substring-before($text,$replace)"/>
<xsl:value-of select="$with"/>
@mfurlend
mfurlend / bootstrap viewport helper
Last active October 2, 2015 17:34
Display your current viewport (xs, sm, md or lg) context when using Bootstrap
/*Detect Your Current Viewport Context
This small CSS snippet will display your current viewport (xs, sm, md or lg) context when using Bootstrap. It can be useful for testing responsive sites, or demoing responsive behaviors on different viewports. Hope it helps someone out there!
*/
body::before {
content: "xs";
position: fixed;
top: 0;
left: 0;
z-index: 9999999;
background-color: #000;
@mfurlend
mfurlend / git_branch_from_changes.md
Last active November 20, 2015 20:40
Create a git branch from (un?)committed changes

If you hadn't made any commit yet, only (1: branch) and (3: checkout) would be enough.
Or, in one command: git checkout -b newBranch.

As mentioned in the [git reset man page][1]:

1. $ git branch topic/wip    
2. $ git reset --soft HEAD~3 
     (or --hard to remove unindexed files) 
2. $ git checkout topic/wip