Skip to content

Instantly share code, notes, and snippets.

View nickel's full-sized avatar
🎩

Juan Gallego IV nickel

🎩
View GitHub Profile
@nickel
nickel / 0_reuse_code.js
Created October 16, 2016 15:56
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

Keybase proof

I hereby claim:

  • I am nickel on github.
  • I am nickel (https://keybase.io/nickel) on keybase.
  • I have a public key whose fingerprint is A54A E76E B39D CF5E 34D3 3FC1 7C9A 2D7F 3231 4A6C

To claim this, I am signing this object:

@nickel
nickel / quotes
Created July 26, 2011 04:31
Get all the Startup Quotes with this simple ruby script
#!/usr/bin/env ruby
require 'rubygems'
require 'nokogiri'
require 'open-uri'
url_base = "http://startupquote.com/page/"
images_path = File.expand_path(ARGV[0] || "~/Pictures/quotes")
if !File.exists?(images_path)
before "deploy", "deploy:check_revision"
desc "Make sure there is something to deploy"
task :check_revision, :roles => [:web, :app] do
unless `git rev-parse HEAD` == `git rev-parse origin/master`
puts ""
puts " \033[1;33m**************************************************\033[0m"
puts " \033[1;33m* WARNING: HEAD is not the same as origin/master *\033[0m"
puts " \033[1;33m**************************************************\033[0m"
puts ""
function newElement(object_name, method, resource, controller, div, prompt_text){
var name = prompt(prompt_text);
if(name) {
field = object_name + "[name]";
$.post("/" + controller, {'element[name]' : name}, function(response) {
var html = "<select name='" + object_name + "[" + method + "]' id='" + object_name + "_" + method + "'><option value=''/>";
for(var i=0;i<response.length;i++){
html += "<option value='" + response[i][resource].id + "'>" + response[i][resource].name + "</option>"
if(response[i][resource].name == name) {
#! /usr/bin/env ruby
if ARGV[0].nil? || ARGV[1].nil?
puts "Error. Uso: #{$0} wmv_folder/ flv_folder/"
end
Dir.open(ARGV[0]).entries.sort.each do |entry|
if [".", ".."].include? entry
next
end
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
#
# Copyright (C) 2004 Sam Hocevar
# 14 rue de Plaisance, 75014 Paris, France
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
static:
controller: pages
action: show
view: name # El parametro que indica el nombre del contenido estático.
default:
keywords: "charifuflis"
en:
title: I need my seo, dear web developer
module SimpleCachingTTL
CACHETIME = 24 * 3600 # Once per day
def cache(text, path)
FileUtils.mkdir_p(File.dirname(path))
File.open(path, 'w') { |f| f.write( text ) }
text
end
class PagesController < ApplicationController
verify :params => :name, :only => :show, :redirect_to => :root_path
before_filter :set_locale, :ensure_valid, :only => :show
def show
render :template => "pages/#{current_page}"
end
protected