Skip to content

Instantly share code, notes, and snippets.

View cmfcmf's full-sized avatar
🚂
Outside of my work for @google, I may be slow to respond.

Christian Flach cmfcmf

🚂
Outside of my work for @google, I may be slow to respond.
View GitHub Profile
@beberlei
beberlei / ActiveEntity.php
Created June 19, 2011 11:11
Doctrine 2.2 Traits Preview
<?php
use Doctrine\ORM\EntityManager,
Doctrine\ORM\Configuration,
Doctrine\ORM\Mapping\ClassMetadata;
/**
* Active Entity trait
*
* Limitations: a class can only ever be assocaited with ONE active entity manager. Multiple entity managers
@voxpelli
voxpelli / _intro.md
Created March 9, 2012 10:20
Adding Flattr in Jekyll

This is the three parts that I'm using on my Jekyll blog (http://voxpelli.com/) to add Flattr.

I add the "default.html" part in the bottom of the default layouts HTML (the one used by posts). I add it just prior to closing body-tag. Make sure to change the "uid" parameter in the s.src variable to be your Flattr username.

I then add the a-tag in "post.html" in the place where I want the flattr button to appear. Since my blog supports both swedish and english posts I define a language attribute - if you don't use that in your Jekyll-blog then feel free to leave it out. Just be sure to change the domain in the href-attribute to be to your site.

Lastly I add the "default_head.html" part in the head-section of the default layouts HTML (the one used by posts). I also define a language attribute here - if you don't use such an attribute in your Jekyll-blog then switch it to something else or leave it out. Make sure to change the domain and to change the "uid" parameter in the s.src variable to be

<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@mahemoff
mahemoff / names.txt
Created April 5, 2012 22:24
Reserved username list
###
A meta-compilation of:
https://raw.github.com/gist/1453705/d253733a56632a8d2c29321a75c18b627fa4dda8/reserved_usernames.rb
http://blog.postbit.com/reserved-username-list.html
http://www.quora.com/How-do-sites-prevent-vanity-URLs-from-colliding-with-future-features
(Took out some company-specific terms at the top of the first one (e.g. imulus, stacks), added one term so far - 'edits'.)
NOTE: Does not include profanities. You may or may not want to add a list of those.
(See https://www.google.com/search?q=profanity+list, but don't try to apply regexp's here because Scunthorpe - http://en.wikipedia.org/wiki/Scunthorpe_problem)
@paulmillr
paulmillr / active.md
Last active June 21, 2024 13:48
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user =&gt; user.followers &gt; 1000)
@jbonney
jbonney / Gemfile
Created May 9, 2013 11:47
Combine Parsley.js and Twitter Bootstrap
source 'https://rubygems.org'
gem "twitter-bootstrap-rails", ">= 2.2.6", :group => :assets
gem "parsley-rails", "~> 1.1.16.0", :group => :assets
@willurd
willurd / web-servers.md
Last active June 21, 2024 13:36
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@cmfcmf
cmfcmf / User.php
Created July 29, 2013 16:44
New User.php file to use with Zikula 1.3.5 and the OpenID module.
<?php
/**
* Copyright Zikula Foundation 2009 - Zikula Application Framework
*
* This work is contributed to the Zikula Foundation under one or more
* Contributor Agreements and licensed to You under the following license:
*
* @license GNU/LGPLv3 (or at your option, any later version).
* @package Zikula
* @subpackage Users
@cmfcmf
cmfcmf / admin_admin_ajax.js
Created August 24, 2013 17:22
Fixed extmenu drag and drop - Zikula 1.3.5 and 1.3.6. Replace the file `admin_admin_ajax.js` in `system/Admin/javascript` with the file below.
// Copyright Zikula Foundation 2010 - license GNU/LGPLv3 (or at your option, any later version).
Zikula.define("AdminPanel");Zikula.AdminPanel.labels={clickToEdit:Zikula.__("Right-click down arrows to edit tab name"),edit:Zikula.__("Edit category"),remove:Zikula.__("Delete category"),makeDefault:Zikula.__("Make default category"),saving:Zikula.__("Saving")};Zikula.AdminPanel.setupNotices=function(){var b={headerSelector:"strong",headerClassName:"z-systemnoticeheader z-panel-indicator",effectDuration:0.5},a=$$("#z-developernotices ul:first");if($("z-securityanalyzer")){b.active=[0]}Zikula.AdminPanel.noticesPanels=new Zikula.UI.Panels("admin-systemnotices",b);if(a[0]){a[0].removeClassName("z-hide")}};Zikula.AdminPanel.Tab=Class.create({initialize:function(b,a){if(a){this.tab=this.createTab(a)}else{this.tab=$(b)}this.id=/admintab_(\d+)/.exec(this.tab.identify())[1];this.attachActionsMenu();this.attachModulesMenu();this.attachEditor();Droppables.add(this.tab.down("a"),{accept:"draggable",hoverclass:"ajaxhover",on
@cmfcmf
cmfcmf / gist:6396836
Created August 31, 2013 07:58
Linux Search And Replace Source: http://stackoverflow.com/a/8588807/2560557

For the file file.txt:

sed -i 's/abc/abcd/g' file.txt

For all files in the current folder:

find . -maxdepth 1 -type f -exec sed -i 's/abc/abcd/g' {} \;

For the files in the current directory and all subdirectories: