Skip to content

Instantly share code, notes, and snippets.

View Ivanca's full-sized avatar
💭
Why does github has statuses? Microsoft what the hell is wrong with you?🤦‍♂️

Ivan Ivanca

💭
Why does github has statuses? Microsoft what the hell is wrong with you?🤦‍♂️
View GitHub Profile
@Ivanca
Ivanca / function.sexy_comment.php
Last active October 29, 2023 21:21
A PHP function to generate pretty comments for PHP and Javascript.
<?php
/*----------------------------------------------------------------------
|: :|
|: Sexy comments in your code! :|
|: =========================== :|
|: Hi, my name is Ivan I care about programming, music and women. :|
|: Follow me on twitter: @ivanca :|
|: :|
----------------------------------------------------------------------*/
@Ivanca
Ivanca / userscript-rewind-commands-for-ultimate-guitar-web-player.js
Last active January 9, 2023 15:22
Userscript: Rewind Commands For Ultimate-guitar Web Player
// ==UserScript==
// @name Rewind Commands For Ultimate-guitar Web Player
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Use Enter Key to Rewind, twice for current section, great to use with a USB Pedal
// @author Ivan Castellanos
// @match https://tabs.ultimate-guitar.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=ultimate-guitar.com
// @grant none
// ==/UserScript==
@Ivanca
Ivanca / gist:4264971
Created December 12, 2012 04:57
Drag and drop functionality for "requirements.txt" files for http://python3wos.appspot.com/ Tested in latest Google Chrome and Firefox-
(function(){
document.addEventListener("drop", function( e ) {
e.preventDefault();
var blob = e.dataTransfer.files[0].slice();
var binaryReader = new FileReader();
$('.req').removeClass('.req');
binaryReader.addEventListener("load", function( file ) {
var notFound = '';
file.target.result.trim().replace(/==.*/g,'').split(/\n/).forEach(function(pack){
-- Name: auth_group; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE auth_group (
id integer NOT NULL,
name character varying(80) NOT NULL
);
@Ivanca
Ivanca / .zshrc
Created November 28, 2018 21:27
comand "make setup" to do make dev.clone && make dev.checkout && make dev.provision && make dev.up
# put it on .bashrc (or .zshrc for zsh)
# comand "make setup" to do make dev.clone && make dev.checkout && make dev.provision && make dev.up
# optional parameter for devstack git repo to clone
make() {
if [[ $@ =~ ^setup.* ]]; then
sh -ec '
if [ "$2" != "" ]; then
git clone $2
cd devstack
fi
@Ivanca
Ivanca / gist:4586071
Created January 21, 2013 13:33
Fixing console.log in Twitter.com
console.log = function(){ return console.__proto__.log.apply(console, arguments) } ;
import scrapy
class BrickSetSpider(scrapy.Spider):
name = 'brick_spider'
start_urls = ['http://brickset.com/sets/year-2018']
def parse(self, response):
SET_SELECTOR = '.set'
for brickset in response.css(SET_SELECTOR):
def hanoi(n, source, helper, target):
print "hanoi( ", n, source, helper, target, " called"
if n > 0:
# move tower of size n - 1 to helper:
hanoi(n - 1, source, target, helper)
# move disk from source peg to target peg
if source[0]:
disk = source[0].pop()
print "moving " + str(disk) + " from " + source[1] + " to " + target[1]
target[0].append(disk)
@Ivanca
Ivanca / Q-adverts.py
Last active February 23, 2018 02:54
Q adverts translated to python
# Each-prior
#####################################################################
# in Q >>>
types: type'[(1;2h;3.2)]
# returns the type of each element (-7 -5 -9h)
# in PYTHON >>>
numbers = [1, 2, 3.2]
types = list(map(type, numbers))
@Ivanca
Ivanca / to-php56.sh
Last active December 9, 2017 08:26
Upgrading from php5.3 to php5.6 on Amazon Linux AMI
#!/bin/bash
# Stop it all
sudo service httpd stop
sudo service php-fpm stop
# Remove problematic packages
sudo yum remove -y httpd httpd-tools apr apr-util
# Remove old php and php extensions