Skip to content

Instantly share code, notes, and snippets.

Sharnie Ivery sharnie

Block or report user

Report or block sharnie

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
sharnie / gist:984bbe5a3d5c8f582a3a
Last active Aug 29, 2015
replace characters with ASCII code
View gist:984bbe5a3d5c8f582a3a
"sharnie".each_char do |char|
puts char.ord-97 # 97 specify where to start on the ascii table
sharnie / about me
Last active Aug 29, 2015
Links and Information about Sharnie Ivery
View about me
Name: Sharnie Ivery
Tagline: Always Be Coding
Profile Picture:
Treehouse Account:
CoderWall Account:
CodeSchool Account:
Favorite Websites:
sharnie / string_encode_decode_method.rb
Last active Aug 29, 2015
Ruby encode and decode method
View string_encode_decode_method.rb
# created a method name 'encode' that accept an argument 'string'
# and then call the "pack('m')" method on the string
def encode string
# assign encode value of 'I love food' to string_encode variable.
puts string_encode = encode("I love food") # the return value is 'SSBsb3ZlIGZvb2Q='
# encoding strings is pretty cool, but how do you decode them?
sharnie / instagram.rb
Last active Aug 29, 2015
View instagram.rb
require "instagram"
Instagram.configure do |config|
config.client_id = "YOUR CLIENT ID HERE"
config.access_token = "YOUR ACCESS TOKEN HERE"
View SearchController.rb
class SearchController < ApplicationController
def index
access_token = " " # <= YOUR ACCESS TOKEN HERE
client = Instagram.client(access_token: access_token)
default_search = client.tag_search('chicken')
if params[:q]
search_query = client.tag_search(params[:q])
@tag = search_query.present? ? search_query : default_search
sharnie / index.html.erb
Last active Aug 29, 2015
Photo search index page
View index.html.erb
<form action="?" method="get">
<input type="text" name="q" placeholder="Search Instagram photos..." autofocus/>
<% @results.each do |instagram| %>
<%= image_tag instagram.images.low_resolution.url %>
<% end %>
sharnie / find_a_prime_number_in_ruby.rb
Created May 12, 2014
Finding a prime number in Ruby
View find_a_prime_number_in_ruby.rb
def prime? num
return false if num <= 1
i = 2 # starting point
while i < num
return false if num % i == 0 # num is not prime
i += 1 # increment i
return true # if the number is prime
sharnie / javascript_sublime_text_build_system.js
Created May 20, 2014
Add JavaScript build support for Sublime Text
View javascript_sublime_text_build_system.js
"cmd": ["/usr/local/bin/node", "$file", "$file_base_name"],
"working_dir": "${project_path:${folder}}",
"selector": "*.js"
View ruby_file_input_output.rb
Read-only mode. The file pointer is placed at the beginning of the file. This is the default mode.
Read-write mode. The file pointer will be at the beginning of the file.
Write-only mode. Overwrites the file if the file exists. If the file does not exist, creates a new file for writing.
sharnie / javascript_encode_decode_base64.js
Created May 26, 2014
Javascript encode and decode string with base64
View javascript_encode_decode_base64.js
// Define the string
var string = 'Hello World!';
// Encode the String
var encodedString = btoa(string);
console.log(encodedString); // Outputs: "SGVsbG8gV29ybGQh"
// Decode the String
var decodedString = atob(encodedString);
console.log(decodedString); // Outputs: "Hello World!"
You can’t perform that action at this time.