Skip to content

Instantly share code, notes, and snippets.

View klederson's full-sized avatar

Klederson Bueno klederson

View GitHub Profile
@jwage
jwage / .php_cs
Last active May 3, 2023 06:42
php-cs-fixer git pre commit hook
<?php
return Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL)
->fixers([
'short_array_syntax',
'ordered_use',
])
;
@anubhavsinha
anubhavsinha / main.yml
Created March 12, 2015 22:33
newrelic server monitoring ansible role for Ubuntu
# Install newrelic server monitoring
# Add newrelic repository
- apt_repository: repo='deb http://apt.newrelic.com/debian/ newrelic non-free' state=present
# Trust the New Relic GPG key.
- apt_key: url=https://download.newrelic.com/548C16BF.gpg state=present
# Update and install apt packages
- name: Run apt-get update
apt: update_cache=yes
@mathisonian
mathisonian / index.md
Last active March 22, 2023 05:31
requiring npm modules in the browser console

demo gif

The final result: require() any module on npm in your browser console with browserify

This article is written to explain how the above gif works in the chrome (and other) browser consoles. A quick disclaimer: this whole thing is a huge hack, it shouldn't be used for anything seriously, and there are probably much better ways of accomplishing the same.

Update: There are much better ways of accomplishing the same, and the script has been updated to use a much simpler method pulling directly from browserify-cdn. See this thread for details: mathisonian/requirify#5

inspiration

@alganet
alganet / php_pratico_streams.md
Last active August 15, 2021 20:41
PHP Prático: Streams

PHP Prático: Streams

A palavra stream significa corrente. Em geral, qualquer conexão de rede é uma stream, e existem vários tipos de protocolos para streams. Esses protocolos definem como os dados fluem na corrente.

No PHP, vários protocolos são suportados de forma transparente:

<?php
@XoseLluis
XoseLluis / Object.watch.js
Last active May 15, 2016 02:41
Polyfill for the Object.watch/Object.unwatch functions available in Mozilla browsers
/*
Polyfill for the Object.watch/Object.unwatch functions available in Mozilla browsers
https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/watch
you have a test here:
http://www.telecable.es/personales/covam1/deployToNenyures/SourceCode/Object.watch.test.js
and can read more here:
http://deploytonenyures.blogspot.com.es/2013/02/objectwatch-polyfill.html
*/
@klederson
klederson / HTML5StorageMultidimensional.js
Created October 8, 2012 18:23
Adding Multidimensional Support for javascript / html5 sessionStorage , localStorage or just Storage object
/**
*
* MOVED TO: https://github.com/iFind/html5MultidimensionalStorage
*
* This methods extends the default HTML5 Storage object and add support
* to set and get multidimensional data
*
* @example Storage.setObj('users.albums.sexPistols',"blah");
* @example Storage.setObj('users.albums.sexPistols',{ sid : "My Way", nancy : "Bitch" });
* @example Storage.setObj('users.albums.sexPistols.sid',"Other songs");
@Simbul
Simbul / pre-commit
Created February 9, 2012 18:06
Git hook to prevent commits on a staging/production branch
#!/usr/bin/env ruby
# This pre-commit hook will prevent any commit to forbidden branches
# (by default, "staging" and "production").
# Put this file in your local repo, in the .git/hooks folder
# and make sure it is executable.
# The name of the file *must* be "pre-commit" for Git to pick it up.
FORBIDDEN_BRANCHES = ["staging", "production"]
@eligrey
eligrey / object-watch.js
Created April 30, 2010 01:38
object.watch polyfill in ES5
/*
* object.watch polyfill
*
* 2012-04-03
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/