Skip to content

Instantly share code, notes, and snippets.

View pierrevalade's full-sized avatar

Pierre pierrevalade

View GitHub Profile
addEventListener('fetch', event => {
event.respondWith(hideUserIp(event.request))
})
async function hideUserIp(request) {
let headers = new Headers()
headers.set('content-type', request.headers.get('content-type'))
var response = await fetch(request.url, {headers: headers, method: request.method, body: request.body})

This document is a collection of tips to make communication at Sunrise better. Over time, we will change the tips, adapt them, add or remove some tips to keep this collection alive.

Please suggest additions and changes by doing a Pull Request. video on how to do a new Pull Request.

Tips for writing issues that are easy to understand for your team

Use full nouns, instead of pronouns

how to do that:

  • instead of writingI'll update the team once it's ready., write I'll update the team once this document is finalized and ready to be shared.
// Twitter Issue (Can't tweet exclamation mark with v1.1)
// https://dev.twitter.com/discussions/12378
// https://github.com/mikeal/request/issues/578
var escape = function(str) {
return encodeURIComponent(str).replace(/[!*()']/g, function(character) {
return '%' + character.charCodeAt(0).toString(16);
});
};
# make a new app with foursquare inside
run "rm public/index.html"
require 'rubygems'
require 'active_support'
# gem('launchy')
# require 'launchy'
app_name = File.basename(Dir.getwd).to_s.parameterize
# make a new app with foursquare inside
run "rm public/index.html"
if yes?('do you want to register a new app on Foursquare?')
app_name = "generator-app-" + rand(10000).to_s
puts "your app's name: #{app_name}"
puts "create a new app from: https://foursquare.com/developers/register"
puts "Download / welcome page url: http://#{app_name}.herokuapp.com"
puts "Callback url: http://#{app_name}.herokuapp.com/clients/foursquare/callback"
puts "Push url: https://#{app_name}.herokuapp.com/checkins"
def emoji
["E449".to_i(16)].pack("U")
end
<div style="display: none !important;">a cool preview of your email</div>
scale = Math.pow(2, this.map.getZoom());
nw = new google.maps.LatLng(this.map.getBounds().getNorthEast().lat(), this.map.getBounds().getSouthWest().lng());
worldCoordinateNW = this.map.getProjection().fromLatLngToPoint(nw);
worldCoordinate = this.map.getProjection().fromLatLngToPoint(venueMarker.getPosition());
pixelOffset = new google.maps.Point(Math.floor((worldCoordinate.x - worldCoordinateNW.x) * scale), Math.floor((worldCoordinate.y - worldCoordinateNW.y) * scale));
tooltipDiv = $('#explore-tooltip');
tooltip = {
width: tooltipDiv.width(),
height: tooltipDiv.height()
};
# http://stackoverflow.com/questions/2674392/how-to-access-google-maps-api-v3-markers-div-and-its-pixel-position/2692617#2692617
scale = Math.pow 2, @map.getZoom()
nw = new google.maps.LatLng @map.getBounds().getNorthEast().lat(), @map.getBounds().getSouthWest().lng()
worldCoordinateNW = @map.getProjection().fromLatLngToPoint nw
worldCoordinate = @map.getProjection().fromLatLngToPoint venueMarker.getPosition()
pixelOffset = new google.maps.Point Math.floor((worldCoordinate.x - worldCoordinateNW.x) * scale), Math.floor((worldCoordinate.y - worldCoordinateNW.y) * scale)
tooltipDiv = $('#explore-tooltip')
tooltip = width: tooltipDiv.width(), height: tooltipDiv.height()
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *IngredientsCellIdentifier = @"IngredientsCell";
EditingTableViewCell *cell = (EditingTableViewCell *)[tableView dequeueReusableCellWithIdentifier:IngredientsCellIdentifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@"EditingTableViewCell" owner:self options:nil];
cell = editingTableViewCell;
self.editingTableViewCell = nil;
}