Skip to content

Instantly share code, notes, and snippets.

@nenadjaja
nenadjaja / gist:6542230
Created September 12, 2013 18:55
Git config for user ndjaja
alias.l=log --pretty=oneline -n 20 --graph --abbrev-commit
alias.s=status -s
alias.d=!git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat
alias.di=!d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d
alias.p=!git pull; git submodule foreach git pull origin master
alias.c=clone --recursive
alias.ca=!git add -A && git commit -av
alias.go=checkout -B
alias.tags=tag -l
alias.branches=branch -a
# this is my array
posts = [{"name"=> "Post1", "start_on"=>"2015-08-11 10:50:00"}, {"name"=>"Post2", "start_on"=>"2015-08-11 10:50:00"}, {"name"=> "Post3", "start_on"=>"2015-08-14 11:00:00"}, {"name"=> "Post4", "start_on"=>"2015-08-14 11:00:00"}]
# this method should group posts by start_on property
def group(posts)
posts.group_by { |p|
puts "TEST"
puts p.inspect
Time.parse(p['start_on'])
}
var arrayToFlatten = [
'item',
{
someKey: 'someValue',
arrayKey: [ 'h', 'e', 'l', 'l', 'o' ]
},
undefined,
null,
1234,
[ 5, 6, 7, 8 ],
var UrlsClass = function(urls) {
if (this.window === this) {
return new Error("You should use the word new!");
}
this.urls = urls;
};
// ["A", "B", "A", "C"]
// getUrls(10) -> ["C", "A", "B"]
@nenadjaja
nenadjaja / bash_profile
Last active April 25, 2016 20:51
Customized iterm
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function prompt {
local BLACK="\[\033[0;30m\]"
local BLACKBOLD="\[\033[1;30m\]"
local RED="\[\033[0;31m\]"
local REDBOLD="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"
@nenadjaja
nenadjaja / Form styles
Created November 30, 2016 01:03
CSS for the registration form
div#upme-registration {
width: 90% !important;
}
div#upme-registration-form .upme-field-value {
width: 50% !important;
}
button#upme-register {
padding: 10px 20px;
@nenadjaja
nenadjaja / cut bio
Created May 11, 2018 18:31
cut bio
Profile.all.each do |profile|
if (profile.bio && profile.bio.length > 800)
new_bio = profile.bio[0..798].split('.')
new_bio.pop if new_bio.size > 1
updated = new_bio.join() + '.'
profile.update(bio: updated)
end
end
Loading runner configuration...
09:15:57 workers.1 | 2018-05-29T16:15:57Z p-90279 t-ow5l9q1mk DEBUG: New configuration: #<Sneakers::Configuration:0x00007fbdbeeee368 @hash={:error_reporters=>[#<Sneakers::ErrorReporter::DefaultLogger:0x00007fbdc04c8968>], :runner_config_file=>nil, :metrics=>nil, :daemonize=>false, :start_worker_delay=>0.2, :workers=>2, :log=>#<IO:<STDOUT>>, :pid_path=>"sneakers.pid", :amqp_heartbeat=>30, :timeout_job_after=>10 minutes, :prefetch=>10, :threads=>1, :share_threads=>false, :ack=>true, :heartbeat=>30, :hooks=>{:before_fork=>#<Proc:0x00007fbdc6176570@/Users/nena/Documents/projects/mandala/config/initializers/sneakers.rb:33>, :after_fork=>#<Proc:0x00007fbdc6177420@/Users/nena/Documents/projects/mandala/config/initializers/sneakers.rb:26>}, :exchange=>"sneakers", :exchange_options=>{:type=>:direct, :durable=>true, :auto_delete=>false, :arguments=>{}}, :queue_options=>{:durable=>true, :auto_delete=>false, :exclusive=>false, :arguments=>{}}, :amqp=>"amqp://localhost", :vhost=>"/", :handl
Open multiple terminal tabs, and run the following in each one:
1. `$ ganache-cli` (or if you want the new, not released ganache, follow the steps here: )
2. Pull this repo: https://github.com/graphprotocol/hackathon-scaffold and cd into the ethereum folder
3. Run `$ truffle compile` followed by `truffle migrate` --> it should give you the contract address under "Deploying Events"
4. Copy that address, and paste it into `subgraph.yaml` (subgraph manifest) inside of the hackathon-scaffold project
5. Start `ipfs daemon` in a separate terminal tab
6. Run `createdb scaffold` in another tab to create a database
7. Pull graph-node and run:
cargo run -p graph-node --release -- \  13  09:47:43 
--postgres-url postgresql://nevena@localhost:5432/scaffold \
@nenadjaja
nenadjaja / Data-model.md
Last active December 4, 2018 21:44
Data model for subgraphs including deployments, organizations, names..etc
type Subgraph {
  id: ID!
  name: String!
  imageUrl: String!
  featured: Boolean
}

type Deployment {
 id: ID!