This file contains 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
// IE7 support for querySelectorAll in 226 bytes... It's a little slow but better than a 20kb solution when you need something cross platform and lightweight. | |
(function(d){d=document,a=d.styleSheets[0]||d.createStyleSheet();d.querySelectorAll=function(e){a.addRule(e,'f:b');for(var l=d.all,b=0,c=[],f=l.length;b<f;b++)l[b].currentStyle.f&&c.push(l[b]);a.removeRule(0);return c}})() |
This file contains 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 Hapi = require('hapi'); | |
var server = new Hapi.Server(); | |
server.connection({ | |
host: 'localhost', | |
port: 9090 | |
}); | |
server.route([ | |
{ |
This file contains 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
location /nginx_status { | |
stub_status on; | |
access_log off; | |
allow 188.226.130.98; | |
deny all; | |
} |
This file contains 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
#!/bin/bash | |
EVENTS="CREATE,DELETE,MODIFY,MOVED_FROM,MOVED_TO" | |
inotifywait -e "$EVENTS" -m -r --format '%:e %f' /var/www/cdn/files/ | ( | |
WAITING=""; | |
while true; do | |
LINE=""; | |
read -t 1 LINE; | |
if test -z "$LINE"; then |
This file contains 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
package com.moralesf.masquerade; | |
import android.content.Context; | |
import android.content.SharedPreferences; | |
import com.moralesf.masquerade.android.data.MasqueradeApi; | |
import retrofit.RestAdapter; | |
public class ApiHelper { | |
Context context; | |
private MasqueradeApi api; |
This file contains 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 UserRegisterResponse { | |
public Boolean result; | |
public String message; | |
public String token; | |
public int user_id; | |
} |
This file contains 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 UserRegisterRequest { | |
final String regid; | |
final String os; | |
final String device; | |
public UserRegisterRequest(String regid, String os, String device) { | |
this.regid = regid; | |
this.os = os; | |
this.device = device; | |
} |
This file contains 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
... | |
RestAdapter restAdapter = new RestAdapter.Builder() | |
.setEndpoint(context.getString(R.string.api_host)) | |
.build(); | |
api = restAdapter.create(MasqueradeApi.class); | |
api.userRegister(new UserRegisterRequest("MyregId-adde3d2", "Android", "Nexus 5")) | |
.subscribe(new Action1<UserRegisterResponse>() { |
This file contains 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
dependencies { | |
... | |
compile 'com.squareup.retrofit:retrofit:1.9.0' | |
compile 'io.reactivex:rxjava:1.0.0' | |
compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0' | |
compile 'com.squareup.okhttp:okhttp:2.0.0' | |
... | |
} |
This file contains 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
import retrofit.http.Body; | |
import retrofit.http.Header; | |
import retrofit.http.POST; | |
import rx.Observable; | |
public interface MasqueradeApi { | |
@POST("/user/register") | |
Observable<UserRegisterResponse> userRegister(@Body UserRegisterRequest body); |
NewerOlder