Skip to content

Instantly share code, notes, and snippets.

View dsignr's full-sized avatar

Neya dsignr

View GitHub Profile
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active May 7, 2025 05:43
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@danharper
danharper / background.js
Last active April 29, 2025 04:09
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@basti
basti / parse_paypal_date.rb
Last active October 22, 2017 16:42
Snippet to convert PayPal date format to DateTime (taken from: http://rhnh.net/2008/03/17/paypal-ipn-fails-date-standards)
# taken from: http://rhnh.net/2008/03/17/paypal-ipn-fails-date-standards
# parses PayPal non-standard format
DateTime.strptime("18:30:30 Jan 1, 2000 PST", "%H:%M:%S %b %e, %Y %Z").new_offset(0)
# in Rails you can use to_time_in_current_zone to convert it to TimeWithZone
DateTime.strptime("18:30:30 Jan 1, 2000 PST", "%H:%M:%S %b %e, %Y %Z").to_time_in_current_zone
@natritmeyer
natritmeyer / debug_httparty_request.rb
Last active May 24, 2024 20:46
How to debug HTTParty requests
class MyResource
include HTTParty
debug_output $stdout # <= will spit out all request details to the console
#...
end
@hara-y-u
hara-y-u / list_template_methods.html.erb
Last active March 18, 2017 19:19
List Middleman helper methods/variables available in templates.
<% all_methods = self.class.superclass.instance_methods - self.class.superclass.superclass.instance_methods %>
<% output_helpers = ::Padrino::Helpers::OutputHelpers.instance_methods %>
<% tag_helpers = ::Padrino::Helpers::TagHelpers.instance_methods %>
<% asset_tag_helpers = ::Padrino::Helpers::AssetTagHelpers.instance_methods %>
<% form_helpers = ::Padrino::Helpers::FormHelpers.instance_methods %>
<% render_helpers = ::Padrino::Helpers::RenderHelpers.instance_methods %>
<% number_helpers = ::Padrino::Helpers::NumberHelpers.instance_methods %>
<% blog_helpers = Middleman::Blog::Helpers.instance_methods %>
<% mm_methods = all_methods - output_helpers - tag_helpers - asset_tag_helpers - form_helpers - render_helpers - number_helpers %>
@tooky
tooky / Rakefile
Created June 28, 2013 15:37
A simple way to manage a Jekyll static site that uses plugins
require 'heavies_publish'
require 'launchy'
desc 'Publish the site'
task :publish => 'publish:publish'
namespace :publish do
include Heavies::Publish
directory Heavies::Publish.dir
@chrisl8888
chrisl8888 / drupal-views-share-global-text-field
Last active April 23, 2024 04:07
share url's for facebook, twitter, pinterest with just get variables
<ul>
<li class="share-text">Share this>/li>
<li class="share-tw"><a href="http://twitter.com/share?text=[title]"><span></span></a></li>
<li class="share-fb"><a href="http://www.facebook.com/sharer.php?u=/node/[nid]&p=[title]"><span></span></a></li>
<li class="share-pinterest"><a href="http://pinterest.com/pin/create/button/?url=/node/[nid]&description=[title]"><span></span></a></li>
</ul>
@sent-hil
sent-hil / pictures.markdown
Created August 24, 2012 02:18
River (getriver.com): Keep a programming journal.

One of my favorite past times is to look at the notebooks of famous scientists. Da Vinci's notebook is well known, but there plenty others. Worshipping Da Vinci like no other, I bought a Think/Create/Record journal, used it mostly to keep jot down random thoughts and take notes. This was great in the beginning, but the conformity of lines drove me nuts. Only moleskines made blank notebooks, so I had to buy one.

At the same time I started a freelance project. The project itself is irrelevant, but suffice to say it was very complex and spanned several months. It seemed like a perfect opportunity to use the moleskine. Looking back, all my entries fell under few categories:

  • Todo
  • Question
  • Thought
  • Bug
  • Feature
@janogarcia
janogarcia / haml_partials.haml
Created May 3, 2012 11:28
HAML Partials wihout Rails (useful for LiveReload)
/ A simplistic way of loading and rendering HAML partials (header.haml, footer.haml, nav.haml... you name it) without Rails
/ Useful when using tools like LiveReload http://livereload.com/
/ but don't want to configure a web server just to use PHP include/require constructs (discussion http://help.livereload.com/discussions/questions/22-haml-partials)
/ It could be improved/simplified using a helper http://stackoverflow.com/questions/5436769/partial-haml-templating-in-ruby-without-rails/5436973#5436973
/ Check out the Jade version https://gist.github.com/2593727
%html
%body
%header
= Haml::Engine.new(File.read('/path/to/your/partial.haml')).render
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"