Skip to content

Instantly share code, notes, and snippets.

View thejsj's full-sized avatar

Jorge Silva thejsj

View GitHub Profile
@thejsj
thejsj / sending-image.js
Last active July 22, 2019 00:52
Realtime Image Whiteboard
/**
* Client Side
*
* Query an element and listen to files being drarg and dropped in order to
* send the file to the server throuth a POST and a PUT request
*/
// You must have an element with the ID `dropzone`
var el = document.getElementById('dropzone');
@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 / 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 / parseJSON.js
Last active August 15, 2018 16:10
A custom parseJSON funciton
const parseJSON = function (json) {
// Higher-order function to be used for detecting type
const firstAndLastChars = function (first, last) {
return (str) => str[0] === first && str[str.length - 1] === last
}
const isArray = firstAndLastChars('[', ']')
const isObj = firstAndLastChars('{', '}')
const hasDoubleQuotes = firstAndLastChars('"', '"')
const hasSingleQuotes = firstAndLastChars("'", "'")
const isNumber = (str) => (+(str)) + '' === str
@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
#!/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 / MagentoGitIgnore.txt
Last active January 4, 2016 03:39
A gitignore for magento. Only time will tell how good this actually is.
# Ignore File Types
.project
*.sublime-project
*.sublime-workspace
*.tmproj
*.bak
*.swp
*~.nib
# Ignore Default files, Licenses, Readmes, etc.
@thejsj
thejsj / SublimeTextPreferences.json
Created January 17, 2014 16:27
My sublime text settings... just in case I need then again
{
"auto_indent": true,
"create_window_at_startup": false,
"detect_indentation": true,
"font_size": 12.0,
"ignored_packages":
[
"Vintage",
"Markdown"
],
@thejsj
thejsj / createWordpress.sh
Last active January 1, 2016 09:39
Create a Wordpress installation through the command line with its corresponding MySQL database.
#!/bin/bash
# Creating Wordpress Instalation
THIS_YEAR=$(date +%Y)
if [[ -z "$1" ]]; then
PROJECT_NAME=$1
fi;
if [[ -z "$PROJECT_NAME" ]]; then
read -p "Wordpress Project Name : " PROJECT_NAME
@thejsj
thejsj / createRepo.sh
Created December 25, 2013 20:39
Shell script to create github repo remotely using the github API
#!/bin/sh
REPO_NAME=$1
echo "NEW REPO NAME: $REPO_NAME"
echo -n "Are you sure you want to create github repo with name '$REPO_NAME' ? (y/n) > "
if read -t 5 response; then
if [ 'y' = "$response" ]; then
echo "Ok. Let's continue creating Repo"
echo "Creating Repository: $REPO_NAME"
curl -u 'thejsj' https://api.github.com/user/repos -d "{\"name\":\"$REPO_NAME\"}"
# Remember replace USER with your username and REPO with your repository/application name!