Skip to content

Instantly share code, notes, and snippets.

View cantonic's full-sized avatar

Can Edremitoglu cantonic

  • Berlin / Germany
View GitHub Profile
ActionView::Template::Error: ReferenceError: window is not defined
from Object.<anonymous> ((execjs):43890:2)
from __webpack_require__ ((execjs):43857:30)
from (execjs):43877:18
from (execjs):43880:10
from /Users/can/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/ruby_racer_runtime.rb:15:in `rescue in block in initialize'
from /Users/can/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/ruby_racer_runtime.rb:12:in `block in initialize'
from /Users/can/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/ruby_racer_runtime.rb:75:in `block in lock'
from /Users/can/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/ruby_racer_runtime.rb:73:in `Locker'
from /Users/can/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/execjs-2.7.0/lib/execjs/ruby_racer_runtime.rb:73:in `lock'
@cantonic
cantonic / autocommit.sh
Created July 19, 2016 19:50 — forked from trcook/autocommit.sh
auto commit git. use fswatch to setup a file to auto-commit a git repo on file change
#!/bin/bash
# requires fswatch
fswatch -o . -e "\\.git.*"| xargs -n1 -I{} git commit -am "snapshot from autocommit_script.sh"
@cantonic
cantonic / backup.sh
Created July 18, 2016 21:02
Backup multiple dokku postgres instances and upload them to a bucket in S3
#!/bin/bash
S3KEY="CHANGE_ME"
S3SECRET="CHANGE_ME"
bucket='CHANGE_ME'
region='CHANGE_ME'
declare -a apps=("app1" "app2")
echo "Starting to backup - $(date)"
. 1/8 |======== 12 =========>
. 2/8 |==================== 25 =====================>
. 3/8 |=============================== 37 ===============================>
. 4/8 |=========================================== 50 ===========================================>
. 5/8 |===================================================== 62 ======================================================>
. 6/8 |================================================================= 75 ==================================================================>
. 7/8 |============================================================================ 87 ============================================================================>
. 8/8 |======================================================================================= 100 ========================================================================================>|
@cantonic
cantonic / bring_back_windows
Last active August 29, 2015 14:26 — forked from allfro/bring_back_windows
Bring all out of bounds Mac windows back in bounds
on run {input, parameters}
tell application "Finder"
set _bounds to get bounds of window of desktop
end tell
tell application "System Events"
set ids to (unix id of processes whose name is equal to "java")
repeat with _id in ids
tell (first process whose unix id is equal to _id)
class Drive::BaseController < ApplicationController
#...
def update
authorize! :update, object
if object_strong_params[:name] # indicates that the desired action is to rename the object
desired_action = 'rename'
object_plain_params[:name] = case controller_name
when 'files' then object_strong_params[:name] + '.' + object.name.split('.').last
alert "yippie"
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
# encoding: utf-8
class AvatarUploader < CarrierWave::Uploader::Base
# Include RMagick or MiniMagick support:
# include CarrierWave::RMagick
include Cloudinary::CarrierWave
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
@cantonic
cantonic / gist:1bab6dfd7f7cd080b3ba
Created January 19, 2015 17:41
using Rails 4.1.9 on ruby 2.2.0
➜ ravioli git:(final-touch) ✗ rspec spec/features/navigation_spec.rb
/Users/cantonic/.rvm/gems/ruby-2.2.0@ravioli/gems/fog-core-1.24.0/lib/fog/core/collection.rb:148: warning: circular argument reference - filters
/Users/cantonic/.rvm/gems/ruby-2.2.0@ravioli/gems/fog-1.24.0/lib/fog/rackspace/mock_data.rb:42: warning: duplicated key at line 80 ignored: "name"
Setting up the application without customisations (NO presentation mode).
skipping fog configuration
/Users/cantonic/.rvm/gems/ruby-2.2.0@ravioli/gems/actionpack-4.1.9/lib/abstract_controller/helpers.rb:154:in `rescue in block in modules_for_helpers': Missing helper file helpers//users/cantonic/sites/ravioli/app/helpers/application_helper.rb_helper.rb (AbstractController::Helpers::MissingHelperError)
from /Users/cantonic/.rvm/gems/ruby-2.2.0@ravioli/gems/actionpack-4.1.9/lib/abstract_controller/helpers.rb:151:in `block in modules_for_helpers'
from /Users/cantonic/.rvm/gems/ruby-2.2.0@ravioli/gems/actionpack-4.1.9/lib/abstract_controller/helpers.rb:14