Skip to content

Instantly share code, notes, and snippets.

View thejsj's full-sized avatar

Jorge Silva thejsj

View GitHub Profile
#!/bin/sh
#
# A simple commit shell script
# Instructions:
# source ./commit.sh LOCAL_BRANCH_NAME 'COMMIT_MESSAGE'
#
# Example:
# source ./commit.sh staging 'Adding some cool files to this repo'
#
@thejsj
thejsj / adelle-todo.md
Last active August 29, 2015 13:57
Adelle Todo

Bugs

  • Index page
  • Name on node hover

Deployment

  • Register Domain ( which domain? )
  • Create server ( where will this be hosted? )
  • Install Wordpress on server
@thejsj
thejsj / sublime-text-use-settings
Created November 1, 2014 17:11
Sublime Text User Settings
{
"auto_complete": true,
"bold_folder_labels": true,
"caret_style": "blink",
"close_windows_when_empty": true,
"draw_indent_guides": true,
"ensure_newline_at_eof_on_save": true,
"font_face": "menlo",
"font_size": 17.0,
"highlight_line": true,
@thejsj
thejsj / reql.js
Last active August 29, 2015 14:17
ReQL on a JSON
r.http('http://api.reddit.com/subreddits/popular.json')('data')('children')
.map(r.row('data')('title'))
r.expr({name: "jorge"})('name')
r.expr(JSON.parse('{"name": "jorge"}'))('name')
@thejsj
thejsj / if.js
Last active August 29, 2015 14:19
var obj = {
if: function (condition, trueStatement, falseStatement) {
if (condition) return trueStatement;
return falseStatment;
},
in: function () {
console.log('This is an `in` method');
},
arguments: function () {
console.log('This is an `arguments` method');
@thejsj
thejsj / basic-reql-queries
Created May 19, 2015 23:03
Basic ReQL Queries
# Queries
## Setup
Create the database in the data explorer. If you're using a shared instance of RethinkDB, name space your database name with your GitHub handle. If you're running these queries locally, you don't need to name space your database name.
```
r.dbCreate('GITHUB_HANDLE_rethinkdb_workshop')
r.db('GITHUB_HANDLE_rethinkdb_workshop').tableCreate('reddit')
```
@thejsj
thejsj / tableCreate.js
Created May 26, 2015 23:35
A simple script showing RethinkDB's JavaScript API
var r = require('rethinkdb');
var assert = require('assert');
// Sample table names
var sampleTableName1 = 'sample_table_' + Math.floor(Math.random() * 10000);
var sampleTableName2 = 'sample_table_' + Math.floor(Math.random() * 10000);
// Create a table using callbacks
r.connect(function (err, conn) {
r.db('test').tableCreate(sampleTableName1)
def determinePossiblities(i):
result = 1
for ii in range(i):
if(ii) == 0:
pass
elif(ii) == 1:
result = 1
else:
result = result * ii
if i > 0:
@thejsj
thejsj / Nearest Even Integer To Square Root.py
Last active December 22, 2015 12:29
Given any random number (even in this case), find the two closest integers divisible by 2, or the two integers closes to the square root divisible by 2
import math
import random
def calc(num):
resultFound = False
for i in range(1,100):
ii = math.pow(2, i)
s = math.sqrt(num)
r = int(round(s / ii) * ii)
if r > 0:
@thejsj
thejsj / createDatabaseAndUser
Last active January 1, 2016 05:29
Another iteration into a script that creates a database and user
#!/bin/bash
params=" -uroot -p"
echo ' - - - - - - - '
echo 'DB Name : '$1
echo 'Password: '$2
# Create Database
echo ' - - - - - - - '
echo 'CREATE DATABASE IF NOT EXISTS $1;'
# Grant Options (Creates User Automatically)
echo ' - - - - - - - '