Skip to content

Instantly share code, notes, and snippets.

View dsignr's full-sized avatar

Neya dsignr

View GitHub Profile
@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
@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 %>
@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
@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
@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'
});
});
@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!






\

@leecardona
leecardona / RegEx for HTTP Status Codes
Created May 4, 2014 17:25
Javascript Regular Expression for valid HTTP Status Codes
//DEFINE REGEX - valid input range is 100 thru 599
var regEx = /^[1-5][0-9][0-9]$/
//TEST REGEX
regEx.test(99)
=>false
regEx.test(100)
=>true
@mvirkkunen
mvirkkunen / gist:89f61a06819530e48b53
Created May 26, 2014 17:17
Tracker-ish URLs found from "Awesome Screenshot" source code
https://chrome.google.com/webstore/detail/awesome-screenshot-captur/alelhddbbhepgpmgidjdcjakblofbmce
How many trackers does a single Chrome extension need?
Seven.
https://ssl.google-analytics.com/ (manifest.json, javascripts/cga.js)
https://cdn.extensionanalytics.com/ (manifest.json, javascripts/feedback.js)
https://pixel.getpaidfordata.com/ (manifest.json, background.html)
https://tags.crwdcntrl.net/ (manifest.json)
@thluiz
thluiz / httpoison_post_form_request.ex
Created February 1, 2015 21:51
HTTPoison post url encoded form
headers = [
{"Content-Type", "application/x-www-form-urlencoded"},
{"Accept", "text/html"}
]
encoded_text = URI.encode_www_form(text)
body = "text=#{encoded_text}"
case HTTPoison.post(url, body, headers) do
{:ok, %HTTPoison.Response{status_code: 200, body: body}} ->
@anchetaWern
anchetaWern / speech-recognition.js
Created May 16, 2015 09:49
speech-recognition.js
var recognition;
function startRecognition() {
recognition = new webkitSpeechRecognition();
recognition.onstart = function(event) {
updateRec();
};
recognition.onresult = function(event) {
var text = "";
for (var i = event.resultIndex; i < event.results.length; ++i) {