This file contains hidden or 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
$(document).ready -> | |
$('.thing').click (e)-> | |
specialVariable = (some stuff for calculating the variable here) | |
#function I want to run | |
someFunction(special_variable) |
This file contains hidden or 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
SELECT ordered_posts.vote_score as vote_score,(CASE WHEN current_user_subscriptions.user_id IS NULL THEN '0' ELSE '1' END) as user_is_following, ordered_posts.influencer_id, current_user_subscriptions.user_id | |
FROM (SELECT * FROM posts ORDER BY vote_score desc) as ordered_posts | |
LEFT OUTER JOIN | |
(SELECT * FROM influencer_subscriptions WHERE user_id = 1) AS current_user_subscriptions | |
ON ordered_posts.influencer_id = current_user_subscriptions.influencer_id | |
WHERE ordered_posts.community_board = TRUE | |
GROUP BY influencer_id | |
ORDER BY user_is_following desc, ordered_posts.created_at desc |
This file contains hidden or 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
$(document).on('click', function(e){ | |
if ($(e.target) == $('.learn-more-btn')){ | |
console.log('yo, they're the same element!') | |
}); |
This file contains hidden or 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 bulletinApp = angular.module('bulletinApp', ['ngResource']); | |
bulletinApp.controller('PostsCtrl', ['$scope', 'Post', function($scope, Post){ | |
this.heading = 'Bulletin Board'; | |
this.posts = Post.query(); | |
var PostsCtrl = this; | |
this.create = function(){ |
This file contains hidden or 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
class NumberThing | |
def return_number | |
return 12 | |
end | |
def test(new_number:true) | |
if new_number | |
return_number = 5 | |
else | |
return_number |
This file contains hidden or 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
irb(main):001:0> module Dog | |
irb(main):002:1> def bark | |
irb(main):003:2> puts 'woof' | |
irb(main):004:2> end | |
irb(main):005:1> end | |
=> :bark | |
irb(main):006:0> module Yanik | |
irb(main):007:1> include Dog | |
irb(main):008:1> end | |
=> Yanik |
This file contains hidden or 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
I'm using the SC api, and I just had a question for you guys! | |
I'm noticing from the example in the docs that one has to instantiate a player every time one streams a new track: | |
e.g. | |
SC.stream('/tracks/293').then(function(player){ | |
player.play(); | |
}); | |
In my current implementation, I'm invoking the above every time a new track is played (with the new url stream replacing the old) | |
- is this the intended use, or is there a way of pulling in the next stream without the overhead of reinitializing the player all over again? If not, it seems like I would have to re-attach all my event handlers to the new player instance every time a user clicks to a new track, which |
This file contains hidden or 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
class Range | |
def oscillate(num_times: 1) | |
previous_value = nil | |
num_times.times do |index| | |
first.upto(last) do |value| | |
#protect against repeat values, since | |
#each oscillation directions don't know | |
#about the other, and will otherwise |
This file contains hidden or 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
public class App | |
{ | |
public static void main( String[] args ) | |
{ | |
foo("testing"); | |
} | |
public static void foo (String string) | |
{ |
This file contains hidden or 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
How Google works: | |
Phase 1 - Discovery | |
Google needs to first discover all the webpages that exists. | |
In order to discover new webpages, there are two ways Google would generally do this: | |
1. They work with major web hosts (e.g. GoDaddy, Amazon Web Services, Wix, etc), and get informed of new webpages uploaded to the host by people like you and me. | |
(if you’ve ever made a website before, to actually put it on the internet you know you’d have to upload it to a host company) | |
2. Using software programs called “bots”, they scan previously identified webpages (perhaps from step 1) regularly, searching for possible links to new pages. |
OlderNewer