Skip to content

Instantly share code, notes, and snippets.

View adamelso's full-sized avatar
🚘

Adam Elsodaney adamelso

🚘
View GitHub Profile
@daniellizik-sc
daniellizik-sc / scriptBlocker.js
Created August 31, 2016 17:38
crx block scripts without adblocker/ghostery
// ghostery fucks with POST requests as well as GET
// adblocker screws with tons of stuff
// this simply blocks the GET
// needs to be in crx background with webRequest and webRequestBlocking in permissions
var host = 'd16fk4ms6rqz1v.cloudfront.net';
var blocking = [
`verical.js`
];
@roylines
roylines / haproxy.cfg
Last active July 15, 2023 02:45
haproxy configuration for using with prerender.io
# Change YOUR_TOKEN to your prerender token
# Change http://example.com (server_name) to your website url
frontend my-frontend
mode http
bind :80
# prerender.io
acl user-agent-bot hdr_sub(User-Agent) -i baiduspider twitterbot facebookexternalhit rogerbot linkedinbot embedly showyoubot outbrain pinterest slackbot vkShare W3C_Validator
acl url-asset path_end js css xml less png jpg jpeg gif pdf doc txt ico rss zip mp3 rar exe wmv doc avi ppt mpg mpeg tif wav mov psd ai xls mp4 m4a swf dat dmg iso flv m4v torrent ttf woff
@owainlewis
owainlewis / java7.yml
Created July 24, 2013 10:45
Install Java 7 with Ansible on Ubuntu Linux
---
- name: ensure required packages are installed for Java 7
apt: name=$item state=latest update_cache=yes
with_items:
- python-software-properties
- name: Add Java repository to sources
action: apt_repository repo='ppa:webupd8team/java'
@scarolan
scarolan / Vim_Syntax_for_Vagrantfile
Created June 14, 2013 14:01
Vim syntax highlighting for Vagrant. Drop this into $HOME/.vim/plugin/vagrant.vim to activate.
" Teach vim to syntax highlight Vagrantfile as ruby
"
" Install: $HOME/.vim/plugin/vagrant.vim
" Author: Brandon Philips <brandon@ifup.org>
augroup vagrant
au!
au BufRead,BufNewFile Vagrantfile set filetype=ruby
augroup END
@visenger
visenger / install_scala_sbt.sh
Last active January 31, 2023 19:10
Scala and sbt installation on ubuntu 12.04
#!/bin/sh
# one way (older scala version will be installed)
# sudo apt-get install scala
#2nd way
sudo apt-get remove scala-library scala
wget http://www.scala-lang.org/files/archive/scala-2.11.4.deb
sudo dpkg -i scala-2.11.4.deb
sudo apt-get update
@nikic
nikic / objects_arrays.md
Last active September 5, 2024 01:36
Post explaining why objects often use less memory than arrays (in PHP)

Why objects (usually) use less memory than arrays in PHP

This is just a small post in response to [this tweet][tweet] by Julien Pauli (who by the way is the release manager for PHP 5.5). In the tweet he claims that objects use more memory than arrays in PHP. Even though it can be like that, it's not true in most cases. (Note: This only applies to PHP 5.4 or newer.)

The reason why it's easy to assume that objects are larger than arrays is because objects can be seen as an array of properties and a bit of additional information (like the class it belongs to). And as array + additional info > array it obviously follows that objects are larger. The thing is that in most cases PHP can optimize the array part of it away. So how does that work?

The key here is that objects usually have a predefined set of keys, whereas arrays don't:

@mirzap
mirzap / foundation-menu.php
Created November 9, 2012 14:32 — forked from awshout/foundation4-topbar-menu.php
WordPress Walker for ZURB's Foundation Top Bar
add_theme_support('menus');
/*
http://codex.wordpress.org/Function_Reference/register_nav_menus#Examples
*/
register_nav_menus(array(
'top-bar-l' => 'Left Top Bar', // registers the menu in the WordPress admin menu editor
'top-bar-r' => 'Right Top Bar'
));
@jakzal
jakzal / UserType.php
Last active October 10, 2015 14:48
Using Symfony2 form events to prevent overwriting not submitted fields with empty values
<?php
namespace Acme\Bundle\UserBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormEvent;
class UserType extends AbstractType
@dave1010
dave1010 / gist:3135160
Created July 18, 2012 09:05
WordPress classes
$ ack --php 'class [\w]+'|grep -v '//'|grep -v '*'|grep -v '>'|sed 's/.*class //'|sed 's/ .*//'
WP_Widget
WP_Widget_Factory
WP_Embed
Moxiecode_JSONReader
Moxiecode_JSON
Moxiecode_Logger
GoogleSpell
PSpell
SpellChecker
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active August 26, 2024 11:06 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.