Skip to content

Instantly share code, notes, and snippets.

@thmsobrmlr
thmsobrmlr / restful_curl.sh
Created July 10, 2013 10:08
RESTFul Request with Curl.
# Set request method:
curl -X DELETE http://localhost:3000/books/1
# Set request parameters:
curl -d "book[title]=Test" -d "book[copyright]=1998" http://localhost:3000/books
# Set header:
curl -H "Accept: text/xml" http://localhost:3000/books/sections/1
@thmsobrmlr
thmsobrmlr / create_ssh_key.sh
Created July 10, 2013 10:11
Create a new SSH Key.
ssh-keygen -v -t rsa -f ~/.ssh/my-key-name -C my-key-comment
@thmsobrmlr
thmsobrmlr / rails_console_production.rb
Created July 10, 2013 10:15
Open a rails console in production environment.
bundle exec rails c production
@thmsobrmlr
thmsobrmlr / show_configuration.rb
Created July 10, 2013 10:52
Print the rails configuration in a rails console.
Rails.application.config
@thmsobrmlr
thmsobrmlr / find_duplicates.sql
Created July 10, 2013 17:06
Find duplicate rows in MySQL (having same value for a column). Replace 'column' and 'table' in statement with values specific to the case.
SELECT column, COUNT(*) count FROM table GROUP BY column HAVING count > 1
@thmsobrmlr
thmsobrmlr / delete_duplicates.sql
Created August 23, 2013 11:46
Delete duplicate entries in a table (fast)
create table tmp like mytable;
alter table tmp engine=MyISAM;
insert into tmp select * from mytable;
alter ignore table tmp add unique index(col1,col2);
alter table tmp engine=InnoDB;
@thmsobrmlr
thmsobrmlr / singleton.js
Created October 4, 2015 14:58
ES6 Singleton
let instance = null;
class MySingleton {
constructor() {
if(!instance){
instance = this;
}
return instance;
}
@thmsobrmlr
thmsobrmlr / index.spec.js
Last active June 30, 2016 12:43 — forked from boneskull/index.js
example of Mocha source map support for babel (es2015) and markdown reporter
import {ok} from 'assert';
describe('foo()', () => {
it('should pass', () => {
ok(true);
});
});
<?xml version='1.0' encoding='UTF-8'?>
<md:EntityDescriptor xmlns:md='urn:oasis:names:tc:SAML:2.0:metadata' ID='_d43649c1-8d01-4629-b3e3-ed452806463c' entityID='https://api.staging.workpath.com/v1/saml/metadata/ad-test'>
<md:SPSSODescriptor protocolSupportEnumeration='urn:oasis:names:tc:SAML:2.0:protocol' AuthnRequestsSigned='false' WantAssertionsSigned='false'>
<md:SingleLogoutService Binding='urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect' Location='https://api.staging.workpath.com/v1/saml/logout/ad-test' ResponseLocation='https://api.staging.workpath.com/v1/saml/logout/ad-test'/>
<md:NameIDFormat>
urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress
</md:NameIDFormat>
<md:AssertionConsumerService Binding='urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST' Location='https://api.staging.workpath.com/v1/saml/assert/ad-test' isDefault='true' index='0'/>
</md:SPSSODescriptor>
</md:EntityDescriptor>
@thmsobrmlr
thmsobrmlr / hubspot-meetings-conversion-tracking.js
Created March 27, 2018 21:04
Track conversions of Hubspot Meetings (iframe)
function isHubspotUrl(url) {
var hubspotUrls = [
'https://local.hubspot.com',
'https://app.hubspotqa.com',
'https://app.hubspot.com',
'https://meetings.hubspot.com'
];
return hubspotUrls.indexOf(url) > -1
}