This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Search Suggestions | |
Original design by Visual Idiot - http://dribbble.com/shots/377281-Search-Suggestions | |
*/ | |
html { | |
min-height: 100%; | |
background: -webkit-linear-gradient(#dbddde, #b6babb); | |
font-family: Helvetica Neue, Helvetica, Arial, sans-serif; | |
-webkit-font-smoothing: antialiased; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Produce PHP-style multidimensional array. | |
# | |
# Example | |
# | |
# arr = Marray.new | |
# | |
# arr[1][2][3] = "foo" | |
# => "foo" | |
# | |
# arr[1][2][3] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
guard :minitest, spring: true, all_on_start: false do | |
# with Minitest::Unit | |
watch(%r{^test/(.*)\/?test_(.*)\.rb$}) | |
watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" } | |
watch(%r{^test/test_helper\.rb$}) { 'test' } | |
watch('config/routes.rb') { 'test' } | |
watch(%r{^app/models/(.*?)\.rb$}) do |matches| | |
"test/models/#{matches[1]}_test.rb" | |
end | |
watch('app/views/layouts/application.html.erb') do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Question: | |
# Write a RoR program to find the contiguous subarray within a onedimensional | |
# array of numbers (containing at least one positive number) which has the largest sum. | |
# For example, for the sequence of values −2, 1, −3, 4, −1, 2, 1, −5, 4; the contiguous | |
# subarray with the largest sum is 4, −1, 2, 1, with sum 6. | |
# The program should run as follows <bold is user entry>: | |
# Enter the array : | |
# -2 1 -3 4 -1 2 1 -5 4 | |
# => [-2, 1, -3, 4, -1, 2, 1, -5, 4] | |
# Largest SubArray |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Author : Emad Elsaid (https://github.com/blazeeboy) | |
# | |
# this script is a small practice in implementing | |
# simple sorting algorithms in ruby, i converted | |
# the sorting algorithms from wikipedia pages | |
class Array | |
# Insertion sort is a simple sorting algorithm that builds | |
# the final sorted array (or list) one item at a time. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Paste this in the console of a lesson page | |
* | |
* @return [Array] List of urls for a course | |
*/ | |
$.map($('.up-next-list-item'), function(el) { return $(el).attr('href') }); | |
/** | |
* Paste this on the courses page | |
* Tip: convert the list to String by append .join('\n') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var requests = []; | |
var responses = []; | |
var urls = []; // sample urls | |
$.each(urls, function(url) { | |
requests.push( $.get(url, getQueryParams(), function(resp){ responses.push(resp) }) ); | |
}); | |
// here this is the object to which the arguments is to be passed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// load angular | |
fetch('https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.8/angular.min.js') | |
.then(response => response.text()) | |
.then(text => eval(text)) | |
// load $ | |
fetch('http://code.jquery.com/jquery-2.1.0.js') | |
.then(response => response.text()) | |
.then(text => eval(text)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_.mixin({ | |
isHash: function(object) { | |
return _.isObject(object) && !_.isArray(object); | |
}, | |
capitalize: function(string) { | |
return string.charAt(0).toUpperCase() + string.substring(1).toLowerCase(); | |
}, | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, useEffect } from 'react'; | |
function getNetworkConnection() { | |
return ( | |
window.navigator.connection | |
); | |
} | |
function getNetworkConnectionInfo() { | |
const connection = getNetworkConnection(); |
OlderNewer