Skip to content

Instantly share code, notes, and snippets.

View ivanvc's full-sized avatar
✈️
Traveling May 5th-10th. May be slow to respond.

Iván Valdés Castillo ivanvc

✈️
Traveling May 5th-10th. May be slow to respond.
View GitHub Profile

Keybase proof

I hereby claim:

  • I am ivanvc on github.
  • I am ivan (https://keybase.io/ivan) on keybase.
  • I have a public key whose fingerprint is 67A9 5D46 D983 86A2 D31E F773 4037 D377 41ED 0CC5

To claim this, I am signing this object:

[
{
"metric": "install",
"tags": {
"account_id": "12",
"network_id": "8",
"app_key": "cb643172b50f1617ceafbeea4de180f7",
"campaign_id": "70"
},
"aggregateTags": [
@ivanvc
ivanvc / eslint-options.json
Created July 22, 2015 01:07
ESLint options
{
"ecmaFeatures": {
"modules": true,
"jsx": true
},
"env": {
"browser": false,
"es6": true,
"node": true
raise "No file specified" unless ARGV[0]
raise "File does not exist" unless File.exists?(ARGV[0])
raise "File is not readable" unless File.readable?(ARGV[0])
file = File.open(ARGV[0])
cells = Array.new(30000, 0)
min_size = 0
max_size = 255
location = 0
reset_colour="$(echo -n '\e[0m')"
bold_colour="$(echo -n '\e[1m')"
# Foreground
grey="$(echo -n '\e[30m')"
red="$(echo -n '\e[31m')"
green="$(echo -n '\e[32m')"
yellow="$(echo -n '\e[33m')"
blue="$(echo -n '\e[34m')"
namespace :spec do
desc "Run remote tests"
Spec::Rake::SpecTask.new(:remote) do |t|
t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
t.spec_files = FileList['spec/remote/**/*_spec.rb']
end
end
class CryptoTest
attr_reader :key, :iv
# Initiliaze it with a hash
# Possible options: key, and initialization vector
# examples
# CryptoTest.new #=> Will generate random iv and key
# CryptoTest.new(:key => "hexadecimal string") #=> Will generate random initialization vector
# CryptoTest.new(:iv => "hexadecimal string") #=> Will generate random key
# CryptoTest.new(:iv => "hexadecimal string", :key => "hexadecimal string") #=> Won't generate anything
# Rebase
$ git commit -a -m "Commit message"
$ git fetch
$ git rebase [branch] # origin/master
$ git push
# Stash
$ git stash
$ git pull
$ git stash apply
class ChangeDefaultDeviceSettings < ActiveRecord::Migration
def self.up
execute "ALTER TABLE `#{User.table_name}` CHANGE `can_dm_me` `can_dm_me` TINYINT(1) NOT NULL DEFAULT 0"
execute "ALTER TABLE `#{User.table_name}` CHANGE `can_email_me` `can_email_me` TINYINT(1) NOT NULL DEFAULT 1"
end
def self.down
execute "ALTER TABLE `#{User.table_name}` CHANGE `can_dm_me` TINYINT(1) NOT NULL DEFAULT 1"
execute "ALTER TABLE `#{User.table_name}` CHANGE `can_email_me` `can_email_me` TINYINT(1) NOT NULL DEFAULT 0"
sdfsdfsdfsssssssssssss