Skip to content

Instantly share code, notes, and snippets.

var Webflow = Webflow || [];
Webflow.push(function() {
MemberStack.onReady.then(function(member) {
// handle the link click yourself
function triggerClick(event) {
event.preventDefault();
window.location.assign("https://website.com?id=" + member.id);
}
@ChrisDrit
ChrisDrit / gist:51813f2a4e78a1791764b76e5b8f0964
Created October 23, 2020 19:11
NoCodeQuest Editable Forms Snippet
<input type="hidden" name="Member Id" ms-data="id">
<input type="hidden" name="Comment Id" value=''>
<script>
var Webflow = Webflow || [];
Webflow.push(function() {
$('#Name').val('');
$('#Comment').val('');
});
</script>
@ChrisDrit
ChrisDrit / gist:b631493912ddadbdb34ddd7ea8e1b062
Last active February 28, 2020 12:15
[Code] Webflow on form submit redirect page.
<script>
var Webflow = Webflow || [];
Webflow.push(function() {
$(document).on('submit', 'form', function() {
setTimeout(function() { location.reload(true); }, 3000);
});
});
</script>
@ChrisDrit
ChrisDrit / all_files.rake
Created June 11, 2019 17:20
Ruby Rake Task Methods
# -----------
# In reference to:
# http://www.albertoalmagro.com/ruby-methods-defined-in-rake-tasks/
# -----------
# Rakefile
# Load tasks
Dir.glob('*.rake').each do |path|
load path
end
@ChrisDrit
ChrisDrit / count.rb
Last active December 7, 2018 18:18
Example code
# ~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
#
# ~= Coding Challenge =~
#
# The following coding challenge was presented to me:
#
# Write some code, that will flatten an array of arbitrarily nested
# arrays of integers into a flat array of integers.
# e.g. [[1,2,[3]],4] -> [1,2,3,4].
#
@ChrisDrit
ChrisDrit / gist:713297
Created November 24, 2010 07:56
insertNewObject
- (void)insertNewObject {
// Create a new instance of the entity managed by the fetched results controller.
NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext];
NSEntityDescription *entity = [[self.fetchedResultsController fetchRequest] entity];
// Loop through array of hashes and save
for (NSMutableDictionary *story in stories) {
NSManagedObject *storiesData = [NSEntityDescription insertNewObjectForEntityForName:[entity name] inManagedObjectContext:context];
@ChrisDrit
ChrisDrit / Citrusbyte.rb
Created July 12, 2017 18:16
Citrusbyte Code Example from Chris Dritsas
# ----------------------
# Chris Dritsas
# Code Example
# ----------------------
# return flattened array
def squash(data=[])
# validate
raise "argument must be a non-empty array" if data.empty? or !data.is_a? Array
<h3>Collect Name of&nbsp;Restaurant, Phone Number and Address from URL provided.</h3>
<div class="highlight-box">
<ul>
<li>For this &quot;HIT url&quot; below, enter the Name of the Restaurant,&nbsp;the Phone Number, and the Address</li>
</ul>
<ul>
<li>Example - Name of Restaurant:&nbsp;<b><i>Guerilla Cafe</i></b></li>
<li>Example - Phone Number:&nbsp;<b><i>(510) 845-2233</i></b></li>
<li>Example - Address:&nbsp;<b><i>1620 Shattuck Ave, Berkeley, CA 94709</i></b></li>
<li>Exmaple above can be found at this url (<u>this is only an example url and <b>NOT</b> the &quot;HIT url&quot; - do <b>NOT</b> collect data from this example url</u>):&nbsp;http://bit.ly/UR3Oki</li>
def tip(msg); puts; puts msg; puts "-"*100; end
#
# 30 Ruby 1.9 Tips, Tricks & Features:
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/
#
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2"
tip "Ruby 1.9 supports named captures in regular expressions!"
@ChrisDrit
ChrisDrit / gist:724665
Created December 2, 2010 02:57
Custom image position within a TableViews Cell
UIImageView *iconView = [[[UIImageView alloc] initWithFrame:CGRectMake(
50,
25,
24,
16
)] autorelease];
UIImage *iconImage = [UIImage imageNamed:@"eye.png"];
iconView.image = iconImage;
[[cell contentView] addSubview:iconView];