Skip to content

Instantly share code, notes, and snippets.

View AntiGameZ's full-sized avatar

Sijie Chen AntiGameZ

View GitHub Profile
@AntiGameZ
AntiGameZ / modernizer_and_jquery
Created October 7, 2011 13:07
Modernizer Load & fallbacks
Modernizr.load([
{
load: '//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.js',
complete: function () {
if ( !window.jQuery ) {
Modernizr.load('js/libs/jquery-1.6.1.min.js');
}
}
},
{
@AntiGameZ
AntiGameZ / gist:1319111
Created October 27, 2011 09:06 — forked from disinfeqt/gist:1319014
Twitter bust
<script>
function bust () {
document.write = "";
window.top.location = window.self.location;
setTimeout(function() {
document.body.innerHTML = '';
}, 0);
window.self.onload = function(evt) {
document.body.innerHTML = '';
};
@AntiGameZ
AntiGameZ / paginated_collection.js
Created October 30, 2011 12:43 — forked from io41/paginated_collection.js
Pagination with Backbone.js
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
typeof(options) != 'undefined' || (options = {});
this.page = 1;
typeof(this.perPage) != 'undefined' || (this.perPage = 10);
},
fetch: function(options) {
@AntiGameZ
AntiGameZ / backbone-monkey-patch.js
Created October 30, 2011 12:43 — forked from webmat/backbone-monkey-patch.js
Getting pagination information from headers with Backbone
// Get the pagination information from the response headers
// Wrap Backbone.sync to save the pagination header on the response object.
Backbone.sync_with_pagination = function(method, model, success, error) {
var success_with_pagination = function(resp, status, xhr) {
resp.next_page = xhr.getResponseHeader('X-Next-Page');
return success(resp);
}
return Backbone.sync_without_pagination(method, model, success_with_pagination, error);
};
@AntiGameZ
AntiGameZ / git-path
Created February 28, 2012 01:35
setup git PATH for non-terminal programs
#!/bin/sh
append_path () {
input="$1"
value="$2"
if ! echo $input | /usr/bin/egrep -q "(^|:)$value($|:)" ; then
if [ "$3" = "after" ] ; then
echo $input:$value
else
echo $value:$input
@AntiGameZ
AntiGameZ / rstudio
Created September 17, 2012 12:02
R-Studio
Dka1C0PfRVSA7oyA6Z15Jv2N1v27cWffdYjC5DyGMx4h1Lnf/wDARy/FySqUPS+f31hHKRoA61Hp8Qru8kf8xxp6b1stoweyN3OMgg4RHEhiaa2AwnOvVoYMAJ1v
@AntiGameZ
AntiGameZ / ICache.cs
Created December 6, 2012 14:51
Yeah I would say this is just a repository pattern than cache repository, the data stored is in the cache thats all but as you said the http cache does need refactoring. Something like this would help, so that one doesnt have to cast back the item, and
public interface ICache
{
/// <summary>
/// Get the Type from Cache with key
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <returns></returns>
T Get<T>(string key);
///
/// Serialises an object to a unicode string
///
/// The object to serialise
/// A string representing the serialised object
public static string Serialise(object objectToSerialise)
{
//create an xml serialiser for the object's type
XmlSerializer ser = new XmlSerializer(objectToSerialise.GetType());
//create a memory stream object to hold the data for the serialised type
@AntiGameZ
AntiGameZ / go.sh
Created October 11, 2016 08:03
USC-Course-Preference
curl -X POST -H "Cache-Control: no-cache" -H "Postman-Token: 919ea746-ec49-11df-ddee-09482eedef73" -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" -F "f_name=你的名字" -F "l_name=你的姓氏Chen" -F "email=你的usc邮箱" -F "email_confirm=你的usc邮箱" -F "uscid=你的usc-id" -F "us_citizen=0" -F "save=Continue On To Course Preferences" "https://vsoeapp1.vsoe.usc.edu/non_cms_versions/course_preferences/"
ffmpeg -i "http://host/folder/file.m3u8" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 file.mp4