Skip to content

Instantly share code, notes, and snippets.


AJ Alves zerokol

View GitHub Profile
gustavlrsn / Layout.js
Created May 1, 2017
Example bootstrap 4 integration into Next.js, with the reactstrap package
View Layout.js
import Head from 'next/head'
import { Container } from 'reactstrap'
const Layout = (props) => (
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
<link rel="stylesheet" href="" />
ecleel / db_fixtures_dump.rake
Last active Jan 18, 2021 — forked from iiska/db_fixtures_dump.rake
Rails 5: Dump Rails db to fixtures
View db_fixtures_dump.rake
# Original from by MichaelBoutros
# Optimized version which uses to_yaml for content creation and checks
# that models are ActiveRecord::Base models before trying to fetch
# them from database.
namespace :db do
namespace :fixtures do
desc 'Dumps all models into fixtures.'
task :dump => :environment do
models = Dir.glob(Rails.root + 'app/models/**.rb').map do |s|

Electron SQLite3 Integration

When trying to use the node-sqlite3 module in Electron I got the error:

Error: Cannot find module '/path/to/my/application/node_modules/sqlite3/lib/binding/electron-v1.4-linux-x64/node_sqlite3.node'

Using Ubuntu 16.04 with Node 7.1.0 and Electron 1.4.12.

I read the following:

notsobad /
Created Aug 4, 2016
count 50x error in nginx error log
# By notsobad
if [ "$f" = "" ]; then
echo "Usage: $0 LOG_FILE" 1>&2
echo "like: $0 /var/log/nginx/"
echo "or: $0 /var/log/nginx/"
exit 1
View rspec_cheatsheet_controller_spec.rb
require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
describe "GET #index" do
#describe "POST #create" do
#describe "GET #show" do
#describe "PATCH #update" do (or PUT #update)
#describe "DELETE #destroy" do
#describe "GET #new" do
ebouchut / disable_postgres_autostart_on_macos
Created Apr 16, 2014
Disable Postgres (installed with Homebrew) autostart on MacOS
View disable_postgres_autostart_on_macos
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
doole /
Last active Mar 12, 2021
Install PostgreSQL PHP extensions on Mac OS X
# Install Xcode Command Line Tools first (required)
xcode-select --install
# Check PHP version `php --version`
PHP_VER=$(php -v | head -1 | awk '{ print $2 }')
# Extensions directory (default: empty string)
kristopherjohnson /
Created Nov 20, 2013
Bash script to set up ANDROID_SDK_ROOT and PATH for Android tools on Mac OS X with ADT bundle installed
# Setup for use of Android SDK tools from command line
# Set ANDROID_SDK_ROOT to point to the root of the SDK installation
export ANDROID_SDK_ROOT='/Applications/adt-bundle-mac-x86_64-20130729/sdk'
export PATH=$PATH:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools:$ANDROID_SDK_ROOT/tools/lib/x86_64
View Simple HTTP server in Ruby and Python
Simple Ruby Server:
# ruby -run -e httpd -- -p 5000 .
Simple Python Server:
# python -m SimpleHTTPServer
kyletcarlson / rspec_model_testing_template.rb
Last active Apr 9, 2021
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
View rspec_model_testing_template.rb
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
# @kyletcarlson
# This skeleton also assumes you're using the following gems: