Skip to content

Instantly share code, notes, and snippets.

View gumeniukcom's full-sized avatar
:octocat:
Focusing

Stanislav Gumeniuk gumeniukcom

:octocat:
Focusing
View GitHub Profile
@cdown
cdown / gist:1163649
Last active November 17, 2024 21:46
Bash urlencode and urldecode
urlencode() {
# urlencode <string>
old_lc_collate=$LC_COLLATE
LC_COLLATE=C
local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:$i:1}"
case $c in
@gmarik
gmarik / README.md
Created October 21, 2011 21:44
phantomjs qunit.js example

About

minimal example of using [phantomjs] with [qunit]

$ phantomjs run-qunit.js file://`pwd`/test.html
'waitFor()' finished in 200ms.
Tests completed in 21 milliseconds.
5 tests of 5 passed, 0 failed.

Installation

@bradt
bradt / setup-dnsmasq-os-x-lion
Created March 11, 2012 20:23
Setting up dnsmasq for Local Web Development Testing on any Device
# Setting up dnsmasq for Local Web Development Testing on any Device
Please note, these instructions are for OS X Lion.
First, you need to get the IP address of your machine on your local network. In OS X, the easiest place to find this is in System Preferences > Network. If you're using DHCP on your local network, you will want to make sure your computer requests the same IP address when it renews it's IP address lease. I recommend configuring the DCHP Reservation settings on your router to accomplish this. Otherwise, you can specify a manual address in your network settings:
1. Go to *System Preferences > Network*
1. Click *Advanced...*
@jonathanmoore
jonathanmoore / gist:2640302
Created May 8, 2012 23:17
Get the share counts from various APIs

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@nickyleach
nickyleach / Lock.php
Created September 10, 2012 22:54
Simple redis-backed Mutex
<?
class Lock {
const TIMEOUT = 20;
const SLEEP = 100000;
/**
* Stores the expire time of the currently held lock
* @var int
@vdubyna
vdubyna / build.xml
Created October 23, 2012 18:58
php and teamcity
<?xml version="1.0" encoding="UTF-8"?>
<project name="Application" default="build" basedir="../">
<target name="build" depends="prepare,phpunit,phpmd,phpcpd,phpdoc,phpcb,phpdcd,phploc,phpcs"/>
<property name="applicationDir" value="${basedir}/source" />
<property name="buildDir" value="${basedir}/build" />
<target name="prepare">
<mkdir dir="${buildDir}/logs" />
@vestel
vestel / README
Created November 17, 2012 00:17
Adds Suunto HR information (from Movescount) to workout in Endomondo
# This is draft version
# so code is ugly
# Possible todos:
* Code cleanup :)
* Accept filenames from command lines
* Create new file from date
* Create missing Trackpoints (for location based sports, like swimming)
* Refactor merge (do believe it might go slow on long distance run)
* Update sport name in file
@wm
wm / Powerline.md
Last active September 6, 2022 00:55
Installing powerline on Mac OSX. The following was done in version Version 10.8.2

Install dependencies

brew install cmake
brew install python
sudo easy_install pip

Add powerline bin to your path. In your zshrc file (or the paths files sourced in zshrc) add the following line

PATH="/usr/local/share/python/:$PATH"

Reinstall MacVim with brew

@kotopes
kotopes / gist:5963750
Last active December 19, 2015 13:39
Nginx + LUA Proxy to url with Referer changes. Uses: socket.url lua lib and LUA compiled in nginx. Lib get from: http://files.luaforge.net/releases/luasocket/luasocket/luasocket-2.0.2/luasocket-2.0.2.tar.gz src\url.lua and place into /usr/local/share/lua/5.1/socket/url.lua Use: http://site.com/aaa/?url=aHR0cDovL21lZGlhLmtpbm8tZ292bm8uY29tL21vdml…
location /aaa/ {
# internal;
set $upstream "";
set $referer "";
set $ref $arg_ref;
set $url $arg_url;
set $tohost "";
set $newuri "";
# add_header Content-Type text/plain;
@RobinUS2
RobinUS2 / output-transparent-pixel.go
Created November 25, 2013 11:23
Output a 1x1 transparent gif pixel in Go webserver response. Please note, this is only the relevant code, does not work "out-of-the-box".
import (
"fmt"
"net/http"
"time"
)
const transPixel = "\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x21\xF9\x04\x01\x00\x00\x00\x00\x2C\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x44\x01\x00\x3B"
func pixelHandler(w http.ResponseWriter, r *http.Request) {
// Pixel