Skip to content

Instantly share code, notes, and snippets.

View getaclue00's full-sized avatar

Alex getaclue00

View GitHub Profile
@getaclue00
getaclue00 / frontend-programming-design-resources.md
Created December 15, 2015 00:39 — forked from DrummerHead/frontend-programming-design-resources.md
List of Front-end, programming & design resources
@getaclue00
getaclue00 / 20101004063749_create_photos.rb
Created December 28, 2015 19:03 — forked from macek/20101004063749_create_photos.rb
How to save uploaded files to your database in Rails
# db/migrate/20101004063749_create_photos.rb
class CreatePhotos < ActiveRecord::Migration
def self.up
create_table :photos do |t|
t.string :name, :null => false
t.binary :data, :null => false
t.string :filename
t.string :mime_type
t.timestamps
@getaclue00
getaclue00 / contactform.js
Created March 14, 2016 00:46 — forked from insin/contactform.js
React contact form example
/** @jsx React.DOM */
var STATES = [
'AL', 'AK', 'AS', 'AZ', 'AR', 'CA', 'CO', 'CT', 'DE', 'DC', 'FL', 'GA', 'HI',
'ID', 'IL', 'IN', 'IA', 'KS', 'KY', 'LA', 'ME', 'MD', 'MA', 'MI', 'MN', 'MS',
'MO', 'MT', 'NE', 'NV', 'NH', 'NJ', 'NM', 'NY', 'NC', 'ND', 'OH', 'OK', 'OR',
'PA', 'RI', 'SC', 'SD', 'TN', 'TX', 'UT', 'VT', 'VA', 'WA', 'WV', 'WI', 'WY'
]
var Example = React.createClass({
@getaclue00
getaclue00 / gist:01b24a338e435a9a1b34826c718f9196
Created July 4, 2016 20:58 — forked from tausen/gist:4261887
pthread, sem_wait, sem_post example
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <pthread.h>
#include <unistd.h>
#include <semaphore.h>
sem_t semaphore;
void threadfunc() {
@getaclue00
getaclue00 / base_controller.rb
Created July 12, 2016 16:23 — forked from dhoelzgen/base_controller.rb
CORS in Rails 4 APIs
class API::V1::BaseController < ApplicationController
skip_before_filter :verify_authenticity_token
before_filter :cors_preflight_check
after_filter :cors_set_access_control_headers
def cors_set_access_control_headers
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'
@getaclue00
getaclue00 / install_postgis_osx.sh
Created July 15, 2016 01:37 — forked from juniorz/install_postgis_osx.sh
Installing PostGIS on Mac OS X and Ubuntu
# Some good references are:
# http://russbrooks.com/2010/11/25/install-postgresql-9-on-os-x
# http://www.paolocorti.net/2008/01/30/installing-postgis-on-ubuntu/
# http://postgis.refractions.net/documentation/manual-1.5/ch02.html#id2630392
#1. Install PostgreSQL postgis and postgres
brew install postgis
initdb /usr/local/var/postgres
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
@getaclue00
getaclue00 / .travis.database.yml
Created September 14, 2016 18:30 — forked from kcampos/.travis.database.yml
Travis CI rake (db:schema:load|db:migrate|db:test:prepare) operations failing w/"table does not exist" error
test:
adapter: mysql2
database: my_app_test
username: root
encoding: utf8
cucumber:
adapter: mysql2
database: my_app_test
username: root
encoding: utf8
@getaclue00
getaclue00 / build.sh
Created November 5, 2016 21:17 — forked from abuiles/build.sh
ember-cli + Rails build
#!/bin/bash
# Based on https://github.com/knomedia/ember-cli-rails/blob/master/build.sh
# for (( i = 0; i < 17; i++ )); do echo "$(tput setaf $i)This is ($i) $(tput sgr0)"; done
function printMessage {
color=$(tput setaf $1)
message=$2
reset=$(tput sgr0)
echo -e "${color}${message}${reset}"
@getaclue00
getaclue00 / nginx.conf
Created January 13, 2017 01:11 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@getaclue00
getaclue00 / nginx.conf
Created January 23, 2017 20:50 — forked from EvgenyKungurov/nginx.conf
RoR + NginX + Puma
#/etc/nginx/sites-available/esrc-chita.ru
upstream esrc-chita.ru {
server unix:///home/esrc/esrc-chita.ru/tmp/sockets/puma.sock;
}
server {
listen 80 default_server;
server_name esrc-chita.ru;
return 301 https://esrc-chita.ru$request_uri;