Skip to content

Instantly share code, notes, and snippets.

View bichotll's full-sized avatar
😶
Doing stuff..

Jaume Tarradas Llort bichotll

😶
Doing stuff..
View GitHub Profile
@bichotll
bichotll / bic_bash_profile.sh
Last active December 16, 2015 03:39
Just a simple bash alert for sudo command. To do it permanent just copy it along your ".bash_profile" file of your home. Maybe it could save you from a "sudo rm / -R" because you forgot the "." before the slash...
#just a secure sudo
bic_sudo() {
echo -e "\e[0;31mAre you sure\e[00;m that you want to use sudo?";
echo -e "\e[0;34mMaybe you can do it in other way..."
echo -e -n '\e[00m'
read suresudo;
if [ $suresudo == "yes" ] || [ $suresudo == "y" ] ;
then
@bichotll
bichotll / wicked_composer.sh
Last active December 16, 2015 06:08
A wicked script for a wicked composer.
#a wicked script composer fix for a wicked unix
bic_wicked_composer() {
org_path=$PWD
sudo mkdir /tmp/mycomposerpath
sudo chown $USER /tmp/mycomposerpath
mv $org_path/* /tmp/mycomposerpath
@bichotll
bichotll / load_disqus_comments_android.java
Last active April 25, 2019 15:19
Load disqus comments with a htmlview in Android
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_comments);
String htmlComments = getHtmlComment("yourId", "yourShortName");
webDisqus = (WebView) findViewById(R.id.disqus);
// set up disqus
WebSettings webSettings2 = webDisqus.getSettings();
@bichotll
bichotll / post_form_ajax_jquery.js
Last active December 17, 2015 17:08
Fast form ajax post/get with searlize parameters
$.post("/load/newcard",
$("#stored_card_form").serialize(),
function(data) {
check_data_form(data);
});
@bichotll
bichotll / parse_errors_json_zend1.js
Last active December 17, 2015 18:50
How to parse errors with Zend 1, json, jQ...
/* php controller */
//$error = array('error' => $form->getMessages());
//$this->_helper->json( json_encode($error) );
/**/
//post get json objects...
function post_confirmation() {
please_wait_ui();
$.post("/load/confirm",
#just a secure sudo
bic_sudo() {
echo -e "\e[0;31mAre you sure\e[00;m that you want to use sudo?";
echo -e "\e[0;34mMaybe you can do it in other way..."
echo -e -n '\e[00m'
read suresudo;
if [ $suresudo == "yes" ] || [ $suresudo == "y" ] ;
then
@bichotll
bichotll / gist:c6701673764950e558f5
Created April 30, 2014 11:15
javascript private methods benchmark
/*
The aim of this test is to check the performance (as speed) and the memory creating instances of objects with public or private methods.
We want to see if create a private method in js really hurts the performance.
For that we will compare the performance creating so many instances and checking the performance
*/
function Public(){
this.publicMethod = function(){
@bichotll
bichotll / gist:4f8ecc929886c1d958a1
Created May 5, 2014 11:02
symfony linux permission problems
#solve symfony linux permission problems
sudo setfacl -R -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs
sudo setfacl -dR -m u:www-data:rwx -m u:`whoami`:rwx app/cache app/logs
@bichotll
bichotll / list-files.sh
Last active August 29, 2015 14:02
Add directory at Home.md (for Wikis)
#create rutes
tree -fi | sed -r 's/\.\/|.md//g' | tail -n +2 | \
while read CMD; do
echo '['$CMD']('$CMD')'
echo ''
done > list-files.md
#check the file length
numberLines=$(cat list-files.md | wc -l)
@bichotll
bichotll / DefaultController.php
Created June 11, 2014 10:02
symfony controller action - how to unsecure but dynamical url parameters example
/**
* Test with / on the url
*
* @Route("/test/{test}", requirements={"test" = "(.*)"})
* @Method("GET")
* @Template()
*/
public function testAction($test) {
if($otherLinks)
{