Skip to content

Instantly share code, notes, and snippets.

View ismailmechbal's full-sized avatar

Ismail Mechbal ismailmechbal

View GitHub Profile
@ismailmechbal
ismailmechbal / routes.md
Created September 14, 2016 06:40 — forked from dideler/routes.md
Rails Routes

A summary of the Rails Guides on Routes, plus other tips.

The Rails router recognizes URLs and dispatches them to a controller's action. It can also generate paths and URLs, avoiding the need to hardcode strings in your views.

Examples

# Redirects /orders/report to orders#report.
get 'orders/report', to: 'orders#report'
@ismailmechbal
ismailmechbal / curl.md
Created September 14, 2016 08:05 — forked from btoone/curl.md
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@ismailmechbal
ismailmechbal / sketch-never-ending.md
Last active January 28, 2022 04:23
Modify Sketch to never ending trial

###Sketch trial non stop

Open hosts files:

$ open /private/etc/hosts

Edit the file adding:

127.0.0.1 backend.bohemiancoding.com

127.0.0.1 bohemiancoding.sketch.analytics.s3-website-us-east-1.amazonaws.com

{
"expand": "full",
"id": 650669458,
"title": "Running: Trail",
"sport": 0,
"start_time": "2015-12-31T13:32:17.000Z",
"local_start_time": "2015-12-31T14:32:17.000+01:00",
"distance": 6.08037,
"duration": 2209.303,
"speed_avg": 9.90779988077688,
# Rakefile to build and compile a Jekyll site into a new directory used at https://www.stockholmsbadrumsrenovering.com
GH_PAGES_DIR = "compiled_site"
desc "Build Jekyll site and copy files"
task :build do
system "jekyll build"
system "rm -r ../#{GH_PAGES_DIR}/*" unless Dir['../#{GH_PAGES_DIR}/*'].empty?
system "cp -r _site/* ../#{GH_PAGES_DIR}/"
end
# Older versions of pg uses procpid whereas newer uses pid.
SELECT pid, pg_terminate_backend(pid) as terminated FROM pg_stat_activity WHERE pid <> pg_backend_pid();
@ismailmechbal
ismailmechbal / .rubocop.yml
Created June 8, 2017 21:27 — forked from jhass/.rubocop.yml
My preferred Rubocop config
AllCops:
RunRailsCops: true
# Commonly used screens these days easily fit more than 80 characters.
Metrics/LineLength:
Max: 120
# Too short methods lead to extraction of single-use methods, which can make
# the code easier to read (by naming things), but can also clutter the class
Metrics/MethodLength:
@ismailmechbal
ismailmechbal / ahoy_base.rb
Created June 19, 2017 15:21 — forked from jabbett/ahoy_base.rb
Setting up Ahoy models to use a separate datastore
module Ahoy
class AhoyBase < ActiveRecord::Base
establish_connection DB_STATS
self.abstract_class = true
end
end
https://graph.facebook.com/oauth/access_token?client_id=<APP_ID>&client_secret=<APP_SECRET>&grant_type=fb_exchange_token&fb_exchange_token=<SHORT_LIVE_ACCESS_TOKEN>
Source
https://www.geekytidbits.com/facebook-posts-from-rails/
class FacebookController < ApplicationController
def initialize
#specify access_token here
@access_token = 'X'
#Picking the graph api object from kaola gem
@graph = Koala::Facebook::API.new(@access_token)
end
def page_wall_post