Skip to content

Instantly share code, notes, and snippets.

View barce's full-sized avatar

Barce barce

View GitHub Profile
@barce
barce / placeholder.js
Created October 4, 2013 18:54
If you need to use the placeholder attribute in IE8, this javascript will make it work.
//
// This is placeholder functionality for IE.
//
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
@barce
barce / instagram_su_list.txt
Last active February 15, 2024 22:07
Instagram's Suggested User LIst
# additions on 10/31/2013:
fazadhili
andrethunder
bmangin
polkaros
itirkkonen
robiatfahlevie
esen_tan
nqou
nathparis
@barce
barce / export.rake
Created October 29, 2013 18:14
code for creating a seeds.rb file from user objects
namespace :export do
desc "Prints seeds in a seeds.rb format"
task :seeds_format => :environment do
User.order(:id).all.each do |user|
# doesn't work on dreamhost
puts "User.create(#{user.serializable_hash.delete_if { |key, value| ['created_at','updated_at','id'].include?(key)}.to_s.gsub(/[{}]/,'')})"
end
end
end
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
@barce
barce / gist:4f31142aaff493cb433e
Created May 30, 2014 18:04
load jquery in console and get average age from a table
var jq = document.createElement('script');
jq.src = "http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type.
jQuery.noConflict();
// get average age from this table: http://www.tdcj.state.tx.us/death_row/dr_executed_offenders.html
var ages = [],
sum = 0;
jQuery('tr').each(function(a,b) {
@barce
barce / gist:9da632eb65499877faf5
Created June 24, 2014 19:21
first 24 hours of #community first likes:followers
70:29909
164:25977
89:3707
305:30594
470:33812
203:5441
189:26191
190:9729
191:1808
61:23969
# Role to delete: viewer
# get role
role = Role.find_by_name('viewer')
# get user
user = User.find_by_email('foo@example.com')
# delete role by looping through role assignments
user.role_assignments.each do |ra|
Verifying that +barce is my Bitcoin username. You can send me #bitcoin here: https://onename.io/barce
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@barce
barce / Locales.yaml
Last active August 29, 2015 14:16 — forked from wojtha/Locales.yaml
# config/locales/en.yml
en:
exception:
show:
not_found:
title: "Not Found"
description: "The page you were looking for does not exists."
internal_server_error:
title: "Internal Server Error"