Skip to content

Instantly share code, notes, and snippets.

@lyoshenka
lyoshenka / git_for_marge.md
Last active August 29, 2015 13:55
Git for marge
  1. ssh -t marge@ts-dev.us "cd topscore; bash" - connect to server

  2. git fetch && git merge origin/master - get latest changes

  3. git add -A && git commit -m "message goes here" - commit changes

  4. git push - push changes

  5. ./symfony fs:snapshot s3 - load the latest database snapshot

@lhitchon
lhitchon / gist:1424751
Created December 2, 2011 20:41
PHP Mongo Test AppFog
<html>
<head>
<title>Demo</title>
</head>
<body>
<h1>PHP Mongo Test</h1>
<?php
$services = getenv("VCAP_SERVICES");
echo "<h2>VCAP_SERVICES</h2>";
echo "<p>" . $services . "</p>";
@michalpipa
michalpipa / router.php
Created December 21, 2011 21:36
Symfony2 router for PHP 5.4 build-in web server
<?php
if (isset($_SERVER['SCRIPT_FILENAME'])) {
return false;
} else {
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT']
. DIRECTORY_SEPARATOR
. 'app.php'
;
@wbrady
wbrady / jekyll-monkey-patch.rb
Created August 15, 2012 14:10
Monkey patch of Jekyll to better handle Liquid errors
module Jekyll
module Convertible
def do_layout(payload, layouts)
info = { :filters => [Jekyll::Filters], :registers => { :site => self.site } }
# render and transform content (this becomes the final content of the object)
payload["pygments_prefix"] = converter.pygments_prefix
payload["pygments_suffix"] = converter.pygments_suffix
begin
@lyoshenka
lyoshenka / export_reader_history.sh
Last active December 19, 2015 00:18
Downloads the entire history of all of your feeds on Google Reader. Data is formatted in JSON, just the way Google Reader uses it. The data for each feed is placed in its own file.
#!/usr/bin/env bash
if [ -z "$1" ]; then
echo "Usage: $0 /path/to/your/subscriptions.xml"
exit 1
fi
grep -o 'xmlUrl="[^"]\+' "$1" | cut -d'"' -f2 | while read FEED; do
FEED_URL="$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$FEED")"
URL="https://www.google.com/reader/api/0/stream/contents/feed/${FEED_URL}?r=n&n=99999"
@mappu
mappu / MbCharacterStream.php
Last active December 21, 2015 00:09
Replacement \Swift_CharacterStream implementation based on the mb_ extension.
<?php
/**
* A CharacterStream implementation which skips over all the manual processing
* performed by NgCharacterStream in favour of using the mb_ extension.
*
* @package Swift
* @author mappu
*/
class Swift_CharacterStream_MbCharacterStream implements Swift_CharacterStream {
<?php
/**
* Basic dispatch function, uses array structured as [$verb => [$path => $route_fn, ...]]
* calling $route_fn if $path/$verb match the arguments passed
*
* @param $path_condition regex for matching paths (must use suitable deliminator, eg. @)
*
* @throws Exception when path/route function missing (programmer error)
* @return bool true for successful route, false for no route/404
*/
@hilbix
hilbix / GIT branch relation aliases
Last active December 29, 2015 17:19
GIT "relate" ALIAS to quickly show how all branches relate to HEAD (or given branch). GIT "graph" ALIAS to show the graph between two commits (from HEAD to it origin, or given branch, by default). `graph` Improved to highlight starting point (which is not always obvious).
git config --global --replace-all alias.relate '!f(){ git for-each-ref --format="%(refname:short) %(upstream:short)" refs | while read -r l r; do printf "%24s %s\\n" "$(git rev-list --cherry-mark --dense --left-right --boundary --oneline "${r:-${1:-HEAD}}...$l" -- | sed "s/^\\(.\\).*/\\1/" | sort | uniq -c | tr -d " " | tr "\\n" " ")" "$l"; done; }; f'
git config --global --replace-all alias.graph '!f(){ case "$#:$1" in 0:) r="HEAD...HEAD@{u}";; 1:*...*) r="$1";; 1:*) r="HEAD...$1";; *) r="$1...$2";; esac; git rev-list --cherry-mark --dense --left-right --boundary --pretty --graph "$r" -- | less -XFp "$(git rev-parse "${r%...*}")"; }; f'
git config --global --replace-all alias.graph1 '!f(){ case "$#:$1" in 0:) r="HEAD...HEAD@{u}";; 1:*...*) r="$1";; 1:*) r="HEAD...$1";; *) r="$1...$2";; esac; git rev-list --cherry-mark --dense --left-right --boundary --oneline --graph "$r" -- | less -XFp "$(git rev-parse "${r%...*}")"; }; f'
# THIS IS PUBLIC DOMAIN.
# Thanks to the makers of GIT for the extremely impressiv
@parkan
parkan / ccr.md
Last active December 30, 2015 23:46 — forked from denisnazarov/ccr.md
Canonical Content Registry

Canonical Content Registry Foundation

Today, there is no reliable way to persist metadata for digital media as it travels across the internet.

Mine is working to build a global content registry on top of the Bitcoin blockchain to serve as an open metadata layer for canonical representations of digital media.

The goal of such a registry is to enable a new decentralized hypermedia protocol that powers the next generation of digital content applications, where creators and consumers to own their media, identity and interactions across the internet, without dependency on industrial or platform gatekeepers.

In March, we published a high level summary of how such such a system could work, titled the Canonical Content Registry. Today, we are taking the first steps to start building it by sharing a proposal for a technical implementation on top of Blockstore. We welcome your feedback and look forward to starting a conversation.

@tauren
tauren / gist:1045906
Created June 24, 2011 23:56
Make it safe to use console.log always. How to convert to coffeescript?
// usage: log('inside coolFunc', this, arguments);
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
window.log = function(){
log.history = log.history || []; // store logs to an array for reference
log.history.push(arguments);
if(this.console) {
arguments.callee = arguments.callee.caller;
console.log( Array.prototype.slice.call(arguments) );
}
};