Skip to content

Instantly share code, notes, and snippets.

Avatar

AJ Alves zerokol

View GitHub Profile
@gustavlrsn
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) => (
<div>
<Head>
<title>PairHub</title>
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" />
</Head>
@ecleel
ecleel / db_fixtures_dump.rake
Last active Sep 21, 2020 — forked from iiska/db_fixtures_dump.rake
Rails 5: Dump Rails db to fixtures
View db_fixtures_dump.rake
# Original from http://snippets.dzone.com/posts/show/4468 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|
View electron-sqlite3.md

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
notsobad / 50x.sh
Created Aug 4, 2016
count 50x error in nginx error log
View 50x.sh
#!/bin/bash
# By notsobad
f=$1
if [ "$f" = "" ]; then
echo "Usage: $0 LOG_FILE" 1>&2
echo "like: $0 /var/log/nginx/www.xxx.com_log-20160313"
echo "or: $0 /var/log/nginx/www.xxx.com_log-20160313.gz"
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
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
doole / install_psql_php.sh
Last active May 20, 2020
Install PostgreSQL PHP extensions on Mac OS X
View install_psql_php.sh
#!/bin/bash
# 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)
EXT_DIR=""
@kristopherjohnson
kristopherjohnson / configure_android_sdk.sh
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
View configure_android_sdk.sh
# 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
kyletcarlson / rspec_model_testing_template.rb
Last active Nov 17, 2020
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:
You can’t perform that action at this time.