Skip to content

Instantly share code, notes, and snippets.

Avatar

Davide Cenzi link82

  • Crunchy Bytes
  • Italy
View GitHub Profile
@shri
shri / pokemon.json
Last active May 1, 2019
JSON of pokemon to go with my pokemonMoves.json file
View pokemon.json
{
"1":{
"name":"Bulbasaur",
"attack":49,
"defense":49,
"evolveLevel":16,
"evolveTo":"2",
"type":"grass",
"moves":[
"tackle",
@emad-elsaid
emad-elsaid / post2fb.rb
Created Mar 3, 2014
posting to facebook groups all at once with ruby posting to facebook groups all at once with ruby
View post2fb.rb
#!/usr/bin/env ruby
require 'koala' # gem install koala --no-ri --no-rdoc
# create a facebook app and get access token from here
# https://developers.facebook.com/tools/explorer
# select "groups", "photos" when authenticating
oauth_access_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
group_filtering_words = ['ruby']
image_path = 'image.png' #change to your image path
message = 'My Cool image.' # your message
@Extazystas
Extazystas / bootstrap_breadcrumbs_builder.rb
Last active Aug 29, 2015
bootstrap builder for breadcrumbs_on_rails gem
View bootstrap_breadcrumbs_builder.rb
# bootstrap builder for breadcrumbs_on_rails gem
class BootstrapBreadcrumbsBuilder < BreadcrumbsOnRails::Breadcrumbs::Builder
def render
@context.content_tag(:ul, class: 'breadcrumb') do
@elements.collect do |element|
render_element(element)
end.join.html_safe
end
end
@ole
ole / update_storyboard_strings.sh
Last active May 9, 2018
Automatically extract translatable strings from Xcode storyboards and update .strings files. Original version by MacRumors forum user mikezang (http://forums.macrumors.com/showpost.php?p=16060008&postcount=4). Slightly updated by Ole Begemann. NOTE: this Gist moved to a regular repo at https://github.com/ole/Storyboard-Strings-Extraction.
View update_storyboard_strings.sh
# (File moved to https://github.com/ole/Storyboard-Strings-Extraction)
@bantic
bantic / bucket_sync_service.rb
Created Nov 15, 2012
ruby class to copy from one aws s3 bucket to another
View bucket_sync_service.rb
require 'aws/s3' # gem name is 'aws-sdk'
class BucketSyncService
attr_reader :from_bucket, :to_bucket, :logger
attr_accessor :debug
DEFAULT_ACL = :public_read
# from_credentials and to_credentials are both hashes with these keys:
# * :aws_access_key_id
@antivanov
antivanov / webcrawler.js
Last active Nov 9, 2020
Simple PhantomJS-based web crawler library
View webcrawler.js
//PhantomJS http://phantomjs.org/ based web crawler Anton Ivanov anton.al.ivanov@gmail.com 2012
//UPDATE: This gist has been made into a Node.js module and now can be installed with "npm install js-crawler"
//the Node.js version does not use Phantom.JS, but the API available to the client is similar to the present gist
(function(host) {
function Crawler() {
this.visitedURLs = {};
};
@rnapier
rnapier / fix-xcode
Last active Sep 24, 2020
Links Xcode SDKs from the /SDKs directory (which you maintain yourself)
View fix-xcode
#!/usr/bin/python
# fix-xcode
# Rob Napier <robnapier@gmail.com>
# Script to link in all your old SDKs every time you upgrade Xcode
# Create a directory called /SDKs (or modify source_path).
# Under it, put all the platform directories:
# MacOSX.platform iPhoneOS.platform iPhoneSimulator.platform
# Under those, store the SDKs:
@linjian
linjian / deferred_garbage_collection_all_in_one.rb
Created Jul 19, 2012
Deferred Garbage Collection All in One
View deferred_garbage_collection_all_in_one.rb
# http://ariejan.net/2011/09/24/rspec-speed-up-by-tweaking-ruby-garbage-collection
#
# Usage:
# DEFER_GC=10 rspec spec/
# DEFER_GC=10 cucumber features/
#
# put it to spec/support/deferred_garbage_collection_all_in_one.rb
# or feature/support/hooks.rb
class DeferredGarbageCollection
DEFERRED_GC_THRESHOLD = (ENV['DEFER_GC'] || -1).to_f
@inopinatus
inopinatus / hstore_accessor.rb
Last active Feb 22, 2019
hstore accessor class method for AR
View hstore_accessor.rb
# include from an initializer
module HstoreAccessor
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def hstore_accessor(hstore_attribute, *keys)
Array(keys).flatten.each do |key|
@rajraj
rajraj / es.sh
Created Jan 3, 2012 — forked from aaronshaf/es.sh
Install ElasticSearch on CentOS 6
View es.sh
cd ~
sudo yum update
sudo yum install java-1.7.0-openjdk.i686 -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.9.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
You can’t perform that action at this time.